package GUI;
/**
 * @author LASO-Team
 *
 */
import java.awt.EventQueue;

import javax.swing.DefaultCellEditor;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;

import sourceFiles.CentralComputer;
import sourceFiles.ChildEntry;
import sourceFiles.GuardianEntry;
import sourceFiles.IGate;
import sourceFiles.IRide;
import sourceFiles.RideEntry;
import sourceFiles.RideState;
import sourceFiles.SupervisorStation;
import sourceFiles.Application;

import java.awt.CardLayout;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import java.awt.Font;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.ButtonGroup;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import javax.swing.ImageIcon;
import javax.swing.JFormattedTextField;

import Exceptions.InvalidAgeParam;
import Exceptions.InvalidCapacity;
import Exceptions.InvalidChildID;
import Exceptions.InvalidGuardianID;
import Exceptions.InvalidHeightParam;
import Exceptions.InvalidRideId;
import Exceptions.TicketDoesntExist;
import Exceptions.XMLRidesParserException;
import Exceptions.CentralComputerExceptions.ChildAgeDoesntMatch;
import Exceptions.CentralComputerExceptions.ChildAlreadyExist;
import Exceptions.CentralComputerExceptions.ChildDoesntHaveTicket;
import Exceptions.CentralComputerExceptions.ChildHeightDoesntMatch;
import Exceptions.CentralComputerExceptions.ChildIDDoesntExist;
import Exceptions.CentralComputerExceptions.ErrorInGuardianPassword;
import Exceptions.CentralComputerExceptions.GuardianAlreadyExist;
import Exceptions.CentralComputerExceptions.GuardianIDDoesntExist;
import Exceptions.CentralComputerExceptions.InvalidPassword;
import Exceptions.CentralComputerExceptions.NoChildrenForGuardian;
import Exceptions.CentralComputerExceptions.RideIDDoesntExist;
import RideExceptions.ChildAlreadyInRideException;
import RideExceptions.ChildNotInRideException;
import RideExceptions.RideActiveException;
import RideExceptions.RideInactiveException;

import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellEditor;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import javax.swing.SwingConstants;
import java.awt.Component;
import java.awt.Color;
import java.awt.SystemColor;

public class MainGui extends JFrame {

	private Integer guardianID = 0;

	private static final int EXIT_CHOISE = 1;
	private static final int DEFAULT_TABLE_SIZE = 20;
	private int childAge;
	private int childHeight;
	private int rideID;

	private IRide selectedRide;

	private LinkedList<JLabel> timerLabelList;

	private JPanel contentPane;
	private JPanel createRidePanel;
	private JPanel supervisorMainPanel;

	private SupervisorStation supervisor;
	private CentralComputer centralComputer;
	private Application application;

	private JLabel lblSupervisorMenu;
	private JButton btnCreateRide;
	private JButton btnEditRide;
	private JButton btnDisplayRidesStatistics;
	private JPanel dataPanel;
	private JPanel buttonsPanel;
	private JLabel label;
	private JLabel lblName;
	private JLabel lblMaximalCapacity;
	private JLabel lblMinimalAge;
	private JLabel lblMinimalHeight;
	private JRadioButton rdbtnYes;
	private JLabel lblExtreme;
	private JRadioButton rdbtnNo;
	private JButton btnAccept;
	private JButton btnCancel;
	private JTextField txtName;
	private final ButtonGroup supervisorRdbGroup = new ButtonGroup();
	private JPanel mainPanel;
	private JLabel lblWelcomeToEpark;
	private JButton btnSupervisorStation;
	private JButton btnRegistration;
	private JButton btnGoToApplication;
	private JButton btnGoToRide;

	private NumberFormat integetFieldFormatter = NumberFormat
			.getIntegerInstance();
	private JTextField frmtdtxtfldMinHeight;
	private JTextField frmtdtxtfldMinAge;
	private JTextField frmtdtxtfldMaxCapacity;
	private JPanel displayTicketsPerRidePanel;
	private JLabel lblTicketsStatisticsFor;

	private JOptionPane invalidInputDialog;
	private JFileChooser fileOpen;

	private Boolean isExtreme = false;
	private JPanel editRidePanel;
	private JPanel editRideDataPanel;
	private JPanel editRideButtonsPane;
	private JLabel lblEditRideTitle;
	private JButton btnEditrideaccept;
	private JButton btnEditridecancel;
	private JLabel lblSupervisorEditRidesId;
	private JTextField frmtdtxtfldSupervisorRideID;
	private JLabel lblRidesNewCapacitiy;
	private JLabel lblRidesNewAge;
	private JLabel lblRidesNewMinimal;
	private JTextField frmtdtxtfldRidesNewCapacity;
	private JTextField frmtdtxtfldRidesNewAge;
	private JTextField frmtdtxtfldRidesNewHeight;
	private JPanel guardinRegistrationPanel;
	private JLabel lblGuardianRegistrationForm;
	private JFormattedTextField frmtdtxtfldGuardianId;
	private JLabel lblGuardianId;
	private JLabel lblGuardiansBillingInformation;
	private JTextField frmtdtxtfldGuardianBillingInfo;
	private JButton btnGuardianaccept;
	private JButton btnGuardiancancel;
	private JPanel childRegistrationPanel;
	private JButton btnRegisterTheChild;
	private JTextField frmtdtxtfldChildsHeight;
	private JTextField frmtdtxtfldChildId;
	private JTextField frmtdtxtfldChildsAge;
	private JLabel lblChildsHeight;
	private JLabel lblChildsAge;
	private JLabel lblChildsId;
	private JLabel lblChildRegistrationForm;
	private JPanel applicationLoginPanel;
	private JLabel lblUserApplicationManu;
	private JButton btnLogin;
	private JLabel lblUserId;
	private JLabel lblUserPassword;
	private JTextField txtUserPassword;
	private JButton btnBackToManu_1;
	private JPanel applicationMenuPanel;

	private JLabel lblDisplayChildrenInRides;
	private JTextField frmtdtxtfldUserid;
	private JPanel childETicketPanel;
	private JLabel lblBuyingCanceling;
	private JScrollPane scrollChildETicket;
	private JScrollPane supervisorScrollPane;

	private JTable statisticsTable;
	private JButton btnButTicket;
	private JButton btnRemoveTicket;
	private JButton btnReturn;
	private JTextField txtChildsAge;
	private JTextField txtChildHeight;
	private JPanel mainRidePanel;
	private JLabel lblChoose;
	private JScrollPane enterRideScrollPanal;
	private JButton btnExitRide;
	private JButton btnRetun;
	private JButton btnEnterRide;
	private JTextField textChildID;
	private JLabel lblChildID;
	private JButton btnCancelChildRegistration;
	private JButton btnReturnFromApp;
	private JPanel applicationChoice;
	private JLabel lblDisplayChildrenOr;
	private JLabel label_1;
	private JLabel label_2;
	private JButton btnReturnMenu;
	private JButton btnDisplayChildrenIn;
	private JButton btnBuyTicketsFor;
	private String chosenChild;
	private JLabel lblYourChildsId;
	private JTextField textChosenChildID;
	private JButton btnBackToChosen;
	private JButton btnBackToManu;
	private JScrollPane scrollPaneChildrenInRides;
	private JButton btnDisplayChildren;

	private LinkedList<ChildEntry> childrenInRide;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					MainGui frame = new MainGui();
					frame.setResizable(false);
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace(); // TODO: Delete me!!!
				}
			}
		});
	}

	private void initilize() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 841, 544);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new CardLayout(0, 0));

		supervisorMainPanel = new JPanel();
		supervisorMainPanel.setBackground(new Color(255, 250, 205));
		contentPane.add(supervisorMainPanel, "name_54024277088108");

		lblSupervisorMenu = new JLabel("Supervisor Menu");
		lblSupervisorMenu.setFont(new Font("Tahoma", Font.BOLD, 30));

		btnCreateRide = new JButton("Create Ride");
		btnCreateRide.setFont(new Font("Tahoma", Font.PLAIN, 20));
		btnCreateRide.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/add-icon (1).png")));
		btnCreateRide.setToolTipText("Press here to create a new ride.");

		btnEditRide = new JButton("Edit Ride");
		btnEditRide.setFont(new Font("Tahoma", Font.PLAIN, 20));
		btnEditRide.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/05-Edit-icon.png")));
		btnEditRide.setToolTipText("Press here to edit an exiting ride.");

		btnDisplayRidesStatistics = new JButton("Rides Statistics");
		btnDisplayRidesStatistics.setFont(new Font("Tahoma", Font.PLAIN, 20));

		btnDisplayRidesStatistics.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/10-Search-icon.png")));
		btnDisplayRidesStatistics
				.setToolTipText("Press here to see the rides.");

		btnBackToManu = new JButton("Back to Menu");
		btnBackToManu.setFont(new Font("Tahoma", Font.PLAIN, 20));
		btnBackToManu.setToolTipText("Go back to main manu");
		btnBackToManu.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/29-House-icon.png")));

		GroupLayout gl_supervisorMainPanel = new GroupLayout(
				supervisorMainPanel);
		gl_supervisorMainPanel.setHorizontalGroup(gl_supervisorMainPanel
				.createParallelGroup(Alignment.LEADING)
				.addGroup(
						gl_supervisorMainPanel
								.createSequentialGroup()
								.addGap(84)
								.addComponent(btnCreateRide)
								.addGap(79)
								.addComponent(btnEditRide)
								.addPreferredGap(ComponentPlacement.RELATED,
										81, Short.MAX_VALUE)
								.addComponent(btnDisplayRidesStatistics)
								.addGap(72))
				.addGroup(
						gl_supervisorMainPanel.createSequentialGroup()
								.addGap(280).addComponent(lblSupervisorMenu)
								.addContainerGap(282, Short.MAX_VALUE))
				.addGroup(
						gl_supervisorMainPanel.createSequentialGroup()
								.addGap(306).addComponent(btnBackToManu)
								.addContainerGap(328, Short.MAX_VALUE)));
		gl_supervisorMainPanel
				.setVerticalGroup(gl_supervisorMainPanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								Alignment.TRAILING,
								gl_supervisorMainPanel
										.createSequentialGroup()
										.addGap(89)
										.addComponent(lblSupervisorMenu)
										.addPreferredGap(
												ComponentPlacement.RELATED,
												153, Short.MAX_VALUE)
										.addGroup(
												gl_supervisorMainPanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																btnCreateRide)
														.addComponent(
																btnEditRide)
														.addComponent(
																btnDisplayRidesStatistics))
										.addGap(83).addComponent(btnBackToManu)
										.addGap(60)));
		supervisorMainPanel.setLayout(gl_supervisorMainPanel);

		createRidePanel = new JPanel();
		createRidePanel.setBackground(new Color(255, 222, 173));
		contentPane.add(createRidePanel, "name_54038456925422");

		dataPanel = new JPanel();
		dataPanel.setBackground(new Color(255, 250, 205));

		buttonsPanel = new JPanel();
		buttonsPanel.setBackground(new Color(255, 250, 205));
		GroupLayout gl_createRidePanel = new GroupLayout(createRidePanel);
		gl_createRidePanel
				.setHorizontalGroup(gl_createRidePanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_createRidePanel
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												gl_createRidePanel
														.createParallelGroup(
																Alignment.LEADING)
														.addComponent(
																buttonsPanel,
																GroupLayout.PREFERRED_SIZE,
																798,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																dataPanel,
																GroupLayout.PREFERRED_SIZE,
																797,
																GroupLayout.PREFERRED_SIZE))
										.addContainerGap(
												GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE)));
		gl_createRidePanel.setVerticalGroup(gl_createRidePanel
				.createParallelGroup(Alignment.LEADING).addGroup(
						gl_createRidePanel
								.createSequentialGroup()
								.addGap(23)
								.addComponent(dataPanel,
										GroupLayout.PREFERRED_SIZE, 352,
										GroupLayout.PREFERRED_SIZE)
								.addPreferredGap(ComponentPlacement.RELATED)
								.addComponent(buttonsPanel,
										GroupLayout.PREFERRED_SIZE, 109,
										GroupLayout.PREFERRED_SIZE)
								.addContainerGap(GroupLayout.DEFAULT_SIZE,
										Short.MAX_VALUE)));

		btnAccept = new JButton("Accept");
		btnAccept.setFont(new Font("Tahoma", Font.PLAIN, 20));
		btnAccept.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/15-Tick-icon.png")));

		btnCancel = new JButton("Cancel");
		btnCancel.setFont(new Font("Tahoma", Font.PLAIN, 20));
		btnCancel.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/14-Delete-icon.png")));

		GroupLayout gl_buttonsPanel = new GroupLayout(buttonsPanel);
		gl_buttonsPanel.setHorizontalGroup(gl_buttonsPanel.createParallelGroup(
				Alignment.LEADING).addGroup(
				gl_buttonsPanel.createSequentialGroup().addGap(272)
						.addComponent(btnAccept).addGap(50)
						.addComponent(btnCancel)
						.addContainerGap(322, Short.MAX_VALUE)));
		gl_buttonsPanel.setVerticalGroup(gl_buttonsPanel.createParallelGroup(
				Alignment.LEADING)
				.addGroup(
						Alignment.TRAILING,
						gl_buttonsPanel
								.createSequentialGroup()
								.addContainerGap(48, Short.MAX_VALUE)
								.addGroup(
										gl_buttonsPanel
												.createParallelGroup(
														Alignment.BASELINE)
												.addComponent(btnAccept)
												.addComponent(btnCancel))
								.addGap(38)));
		buttonsPanel.setLayout(gl_buttonsPanel);

		label = new JLabel("Create Ride Menu");
		label.setFont(new Font("Tahoma", Font.BOLD, 30));

		lblName = new JLabel("Name:");
		lblName.setFont(new Font("Tahoma", Font.PLAIN, 14));

		lblMaximalCapacity = new JLabel("Maximal Capacity:");
		lblMaximalCapacity.setFont(new Font("Tahoma", Font.PLAIN, 14));

		lblMinimalAge = new JLabel("Minimal Age:");
		lblMinimalAge.setFont(new Font("Tahoma", Font.PLAIN, 14));

		lblMinimalHeight = new JLabel("Minimal Height:");
		lblMinimalHeight.setFont(new Font("Tahoma", Font.PLAIN, 14));

		rdbtnYes = new JRadioButton("YES");
		rdbtnYes.setFont(new Font("Tahoma", Font.PLAIN, 14));

		supervisorRdbGroup.add(rdbtnYes);

		lblExtreme = new JLabel("Extreme:");
		lblExtreme.setFont(new Font("Tahoma", Font.PLAIN, 14));

		rdbtnNo = new JRadioButton("NO");
		rdbtnNo.setFont(new Font("Tahoma", Font.PLAIN, 14));
		rdbtnNo.setSelected(true);
		supervisorRdbGroup.add(rdbtnNo);

		txtName = new JTextField();
		txtName.setFont(new Font("Tahoma", Font.PLAIN, 14));
		txtName.setColumns(10);

		frmtdtxtfldMaxCapacity = new JTextField();
		frmtdtxtfldMaxCapacity.setFont(new Font("Tahoma", Font.PLAIN, 14));
		frmtdtxtfldMaxCapacity.setColumns(9);

		frmtdtxtfldMinAge = new JTextField();
		frmtdtxtfldMinAge.setFont(new Font("Tahoma", Font.PLAIN, 14));
		frmtdtxtfldMinAge.setColumns(9);

		frmtdtxtfldMinHeight = new JTextField();
		frmtdtxtfldMinHeight.setFont(new Font("Tahoma", Font.PLAIN, 14));
		frmtdtxtfldMinHeight.setColumns(9);

		GroupLayout gl_dataPanel = new GroupLayout(dataPanel);
		gl_dataPanel
				.setHorizontalGroup(gl_dataPanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_dataPanel
										.createSequentialGroup()
										.addGroup(
												gl_dataPanel
														.createParallelGroup(
																Alignment.LEADING)
														.addGroup(
																gl_dataPanel
																		.createSequentialGroup()
																		.addGap(48)
																		.addGroup(
																				gl_dataPanel
																						.createParallelGroup(
																								Alignment.LEADING)
																						.addComponent(
																								lblExtreme)
																						.addGroup(
																								gl_dataPanel
																										.createSequentialGroup()
																										.addComponent(
																												rdbtnYes)
																										.addPreferredGap(
																												ComponentPlacement.RELATED)
																										.addComponent(
																												rdbtnNo))
																						.addGroup(
																								gl_dataPanel
																										.createSequentialGroup()
																										.addGroup(
																												gl_dataPanel
																														.createParallelGroup(
																																Alignment.LEADING)
																														.addComponent(
																																lblName)
																														.addComponent(
																																lblMaximalCapacity)
																														.addComponent(
																																lblMinimalAge)
																														.addComponent(
																																lblMinimalHeight))
																										.addGap(29)
																										.addGroup(
																												gl_dataPanel
																														.createParallelGroup(
																																Alignment.LEADING)
																														.addComponent(
																																frmtdtxtfldMinHeight,
																																GroupLayout.PREFERRED_SIZE,
																																GroupLayout.DEFAULT_SIZE,
																																GroupLayout.PREFERRED_SIZE)
																														.addComponent(
																																frmtdtxtfldMinAge,
																																GroupLayout.PREFERRED_SIZE,
																																GroupLayout.DEFAULT_SIZE,
																																GroupLayout.PREFERRED_SIZE)
																														.addComponent(
																																txtName,
																																GroupLayout.PREFERRED_SIZE,
																																261,
																																GroupLayout.PREFERRED_SIZE)
																														.addComponent(
																																frmtdtxtfldMaxCapacity,
																																GroupLayout.PREFERRED_SIZE,
																																GroupLayout.DEFAULT_SIZE,
																																GroupLayout.PREFERRED_SIZE)))))
														.addGroup(
																gl_dataPanel
																		.createSequentialGroup()
																		.addGap(289)
																		.addComponent(
																				label)))
										.addContainerGap(298, Short.MAX_VALUE)));
		gl_dataPanel
				.setVerticalGroup(gl_dataPanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_dataPanel
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(label)
										.addGap(38)
										.addGroup(
												gl_dataPanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(lblName)
														.addComponent(
																txtName,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addGap(18)
										.addGroup(
												gl_dataPanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																lblMaximalCapacity)
														.addComponent(
																frmtdtxtfldMaxCapacity,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addGap(18)
										.addGroup(
												gl_dataPanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																lblMinimalAge)
														.addComponent(
																frmtdtxtfldMinAge,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addGap(18)
										.addGroup(
												gl_dataPanel
														.createParallelGroup(
																Alignment.LEADING)
														.addGroup(
																gl_dataPanel
																		.createSequentialGroup()
																		.addComponent(
																				lblMinimalHeight)
																		.addGap(18)
																		.addComponent(
																				lblExtreme)
																		.addGap(18)
																		.addGroup(
																				gl_dataPanel
																						.createParallelGroup(
																								Alignment.BASELINE)
																						.addComponent(
																								rdbtnYes)
																						.addComponent(
																								rdbtnNo)))
														.addComponent(
																frmtdtxtfldMinHeight,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addContainerGap(73, Short.MAX_VALUE)));
		dataPanel.setLayout(gl_dataPanel);
		createRidePanel.setLayout(gl_createRidePanel);

		mainPanel = new JPanel();
		mainPanel.setBackground(new Color(102, 153, 255));
		contentPane.add(mainPanel, "name_57767807737727");

		lblWelcomeToEpark = new JLabel("WELCOME TO E-PARK");
		lblWelcomeToEpark.setFont(new Font("Tahoma", Font.BOLD, 30));

		btnSupervisorStation = new JButton("Supervisor Menu");
		btnSupervisorStation.setFont(new Font("Tahoma", Font.PLAIN, 20));
		btnSupervisorStation.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/Supervisor-icon.png")));

		btnRegistration = new JButton("Registration Menu");
		btnRegistration.setFont(new Font("Tahoma", Font.PLAIN, 20));

		btnRegistration.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/register-icon.png")));

		btnGoToApplication = new JButton("User Application ");
		btnGoToApplication.setFont(new Font("Tahoma", Font.PLAIN, 20));
		btnGoToApplication.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/User-Clients-icon.png")));

		btnGoToRide = new JButton("Entrance\\Exit Ride Menu");
		btnGoToRide.setFont(new Font("Tahoma", Font.PLAIN, 20));
		btnGoToRide.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/Games-icon.png")));
		GroupLayout gl_mainPanel = new GroupLayout(mainPanel);
		gl_mainPanel
				.setHorizontalGroup(gl_mainPanel
						.createParallelGroup(Alignment.TRAILING)
						.addGroup(
								gl_mainPanel
										.createSequentialGroup()
										.addGap(87)
										.addGroup(
												gl_mainPanel
														.createParallelGroup(
																Alignment.LEADING,
																false)
														.addComponent(
																btnGoToApplication,
																Alignment.TRAILING,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.DEFAULT_SIZE,
																Short.MAX_VALUE)
														.addComponent(
																btnSupervisorStation,
																Alignment.TRAILING))
										.addGap(125)
										.addGroup(
												gl_mainPanel
														.createParallelGroup(
																Alignment.TRAILING)
														.addComponent(
																btnRegistration,
																GroupLayout.PREFERRED_SIZE,
																233,
																Short.MAX_VALUE)
														.addComponent(
																btnGoToRide,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.DEFAULT_SIZE,
																Short.MAX_VALUE))
										.addGap(65))
						.addGroup(
								Alignment.LEADING,
								gl_mainPanel.createSequentialGroup()
										.addGap(229)
										.addComponent(lblWelcomeToEpark)
										.addContainerGap(258, Short.MAX_VALUE)));
		gl_mainPanel
				.setVerticalGroup(gl_mainPanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								Alignment.TRAILING,
								gl_mainPanel
										.createSequentialGroup()
										.addGap(75)
										.addComponent(lblWelcomeToEpark)
										.addPreferredGap(
												ComponentPlacement.RELATED,
												125, Short.MAX_VALUE)
										.addGroup(
												gl_mainPanel
														.createParallelGroup(
																Alignment.LEADING)
														.addGroup(
																gl_mainPanel
																		.createSequentialGroup()
																		.addComponent(
																				btnSupervisorStation)
																		.addGap(67)
																		.addComponent(
																				btnGoToApplication))
														.addGroup(
																gl_mainPanel
																		.createSequentialGroup()
																		.addComponent(
																				btnRegistration)
																		.addGap(67)
																		.addComponent(
																				btnGoToRide)))
										.addGap(78)));
		mainPanel.setLayout(gl_mainPanel);

		displayTicketsPerRidePanel = new JPanel();
		displayTicketsPerRidePanel.setBackground(new Color(255, 250, 205));
		contentPane.add(displayTicketsPerRidePanel, "name_62424978909644");

		lblTicketsStatisticsFor = new JLabel("Tickets Statistics for Rides");
		lblTicketsStatisticsFor.setFont(new Font("Tahoma", Font.BOLD, 30));

		supervisorScrollPane = new JScrollPane();

		btnReturn = new JButton("Back to Menu");
		btnReturn.setFont(new Font("Tahoma", Font.PLAIN, 20));
		btnReturn.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/29-House-icon.png")));
		GroupLayout gl_displayTicketsPerRidePanel = new GroupLayout(
				displayTicketsPerRidePanel);
		gl_displayTicketsPerRidePanel
				.setHorizontalGroup(gl_displayTicketsPerRidePanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_displayTicketsPerRidePanel
										.createSequentialGroup()
										.addGap(127)
										.addComponent(supervisorScrollPane,
												GroupLayout.PREFERRED_SIZE,
												533, GroupLayout.PREFERRED_SIZE)
										.addContainerGap(155, Short.MAX_VALUE))
						.addGroup(
								Alignment.TRAILING,
								gl_displayTicketsPerRidePanel
										.createSequentialGroup()
										.addContainerGap(293, Short.MAX_VALUE)
										.addComponent(lblTicketsStatisticsFor)
										.addGap(206))
						.addGroup(
								Alignment.TRAILING,
								gl_displayTicketsPerRidePanel
										.createSequentialGroup()
										.addContainerGap(379, Short.MAX_VALUE)
										.addComponent(btnReturn).addGap(335)));
		gl_displayTicketsPerRidePanel
				.setVerticalGroup(gl_displayTicketsPerRidePanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_displayTicketsPerRidePanel
										.createSequentialGroup()
										.addGap(58)
										.addComponent(lblTicketsStatisticsFor)
										.addGap(18)
										.addComponent(supervisorScrollPane,
												GroupLayout.PREFERRED_SIZE,
												270, GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												ComponentPlacement.RELATED, 41,
												Short.MAX_VALUE)
										.addComponent(btnReturn).addGap(39)));
		displayTicketsPerRidePanel.setLayout(gl_displayTicketsPerRidePanel);

		editRidePanel = new JPanel();
		editRidePanel.setBackground(new Color(255, 222, 173));
		contentPane.add(editRidePanel, "name_72423555854259");

		editRideDataPanel = new JPanel();
		editRideDataPanel.setBackground(new Color(255, 250, 205));

		editRideButtonsPane = new JPanel();
		editRideButtonsPane.setBackground(new Color(255, 250, 205));
		GroupLayout gl_editRidePanel = new GroupLayout(editRidePanel);
		gl_editRidePanel
				.setHorizontalGroup(gl_editRidePanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_editRidePanel
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												gl_editRidePanel
														.createParallelGroup(
																Alignment.LEADING)
														.addComponent(
																editRideButtonsPane,
																GroupLayout.PREFERRED_SIZE,
																794,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																editRideDataPanel,
																GroupLayout.PREFERRED_SIZE,
																794,
																GroupLayout.PREFERRED_SIZE))
										.addContainerGap(11, Short.MAX_VALUE)));
		gl_editRidePanel.setVerticalGroup(gl_editRidePanel.createParallelGroup(
				Alignment.LEADING).addGroup(
				gl_editRidePanel
						.createSequentialGroup()
						.addGap(27)
						.addComponent(editRideDataPanel,
								GroupLayout.PREFERRED_SIZE, 349,
								GroupLayout.PREFERRED_SIZE)
						.addPreferredGap(ComponentPlacement.RELATED)
						.addComponent(editRideButtonsPane,
								GroupLayout.PREFERRED_SIZE, 120,
								GroupLayout.PREFERRED_SIZE)
						.addContainerGap(GroupLayout.DEFAULT_SIZE,
								Short.MAX_VALUE)));

		btnEditrideaccept = new JButton("Accept");
		btnEditrideaccept.setFont(new Font("Tahoma", Font.PLAIN, 20));
		btnEditrideaccept.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/15-Tick-icon.png")));

		btnEditridecancel = new JButton("Cancel");
		btnEditridecancel.setFont(new Font("Tahoma", Font.PLAIN, 20));
		btnEditridecancel.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/14-Delete-icon.png")));
		GroupLayout gl_editRideButtonsPane = new GroupLayout(
				editRideButtonsPane);
		gl_editRideButtonsPane.setHorizontalGroup(gl_editRideButtonsPane
				.createParallelGroup(Alignment.LEADING).addGroup(
						gl_editRideButtonsPane.createSequentialGroup()
								.addGap(215).addComponent(btnEditrideaccept)
								.addGap(117).addComponent(btnEditridecancel)
								.addContainerGap(272, Short.MAX_VALUE)));
		gl_editRideButtonsPane
				.setVerticalGroup(gl_editRideButtonsPane
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								Alignment.TRAILING,
								gl_editRideButtonsPane
										.createSequentialGroup()
										.addContainerGap(32, Short.MAX_VALUE)
										.addGroup(
												gl_editRideButtonsPane
														.createParallelGroup(
																Alignment.TRAILING)
														.addComponent(
																btnEditridecancel)
														.addComponent(
																btnEditrideaccept))
										.addGap(47)));
		editRideButtonsPane.setLayout(gl_editRideButtonsPane);

		lblEditRideTitle = new JLabel("Edit a Ride");
		lblEditRideTitle.setFont(new Font("Tahoma", Font.BOLD, 30));

		lblSupervisorEditRidesId = new JLabel("ride's ID:");
		lblSupervisorEditRidesId.setFont(new Font("Tahoma", Font.PLAIN, 14));

		frmtdtxtfldSupervisorRideID = new JTextField();
		frmtdtxtfldSupervisorRideID.setFont(new Font("Tahoma", Font.PLAIN, 14));
		frmtdtxtfldSupervisorRideID.setColumns(9);

		lblRidesNewCapacitiy = new JLabel("Ride's new maximal capacitiy:");
		lblRidesNewCapacitiy.setFont(new Font("Tahoma", Font.PLAIN, 14));

		lblRidesNewAge = new JLabel("Ride's new minimal age:");
		lblRidesNewAge.setFont(new Font("Tahoma", Font.PLAIN, 14));

		lblRidesNewMinimal = new JLabel("Ride's new minimal height:");
		lblRidesNewMinimal.setFont(new Font("Tahoma", Font.PLAIN, 14));

		frmtdtxtfldRidesNewCapacity = new JTextField();
		frmtdtxtfldRidesNewCapacity.setFont(new Font("Tahoma", Font.PLAIN, 14));
		frmtdtxtfldRidesNewCapacity.setColumns(9);

		frmtdtxtfldRidesNewAge = new JTextField();
		frmtdtxtfldRidesNewAge.setFont(new Font("Tahoma", Font.PLAIN, 14));
		frmtdtxtfldRidesNewAge.setColumns(9);

		frmtdtxtfldRidesNewHeight = new JTextField();
		frmtdtxtfldRidesNewHeight.setFont(new Font("Tahoma", Font.PLAIN, 14));
		frmtdtxtfldRidesNewHeight.setColumns(9);
		GroupLayout gl_editRideDataPanel = new GroupLayout(editRideDataPanel);
		gl_editRideDataPanel
				.setHorizontalGroup(gl_editRideDataPanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_editRideDataPanel
										.createSequentialGroup()
										.addGap(73)
										.addGroup(
												gl_editRideDataPanel
														.createParallelGroup(
																Alignment.LEADING)
														.addComponent(
																lblRidesNewCapacitiy)
														.addComponent(
																lblRidesNewAge)
														.addComponent(
																lblRidesNewMinimal)
														.addComponent(
																lblSupervisorEditRidesId))
										.addGap(18)
										.addGroup(
												gl_editRideDataPanel
														.createParallelGroup(
																Alignment.LEADING)
														.addComponent(
																frmtdtxtfldSupervisorRideID,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																frmtdtxtfldRidesNewHeight,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																frmtdtxtfldRidesNewAge,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																frmtdtxtfldRidesNewCapacity,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addContainerGap(333, Short.MAX_VALUE))
						.addGroup(
								Alignment.TRAILING,
								gl_editRideDataPanel.createSequentialGroup()
										.addContainerGap(328, Short.MAX_VALUE)
										.addComponent(lblEditRideTitle)
										.addGap(304)));
		gl_editRideDataPanel
				.setVerticalGroup(gl_editRideDataPanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_editRideDataPanel
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(lblEditRideTitle)
										.addGap(40)
										.addGroup(
												gl_editRideDataPanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																lblSupervisorEditRidesId)
														.addComponent(
																frmtdtxtfldSupervisorRideID,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addGap(39)
										.addGroup(
												gl_editRideDataPanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																lblRidesNewCapacitiy)
														.addComponent(
																frmtdtxtfldRidesNewCapacity,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addGap(37)
										.addGroup(
												gl_editRideDataPanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																lblRidesNewAge)
														.addComponent(
																frmtdtxtfldRidesNewAge,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addGap(40)
										.addGroup(
												gl_editRideDataPanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																lblRidesNewMinimal)
														.addComponent(
																frmtdtxtfldRidesNewHeight,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addContainerGap(73, Short.MAX_VALUE)));
		editRideDataPanel.setLayout(gl_editRideDataPanel);
		editRidePanel.setLayout(gl_editRidePanel);

		guardinRegistrationPanel = new JPanel();
		guardinRegistrationPanel.setBackground(new Color(255, 228, 225));
		contentPane.add(guardinRegistrationPanel, "name_77217022309117");

		lblGuardianRegistrationForm = new JLabel("Guardian Registration Form");
		lblGuardianRegistrationForm.setFont(new Font("Tahoma", Font.BOLD, 30));

		frmtdtxtfldGuardianId = new JFormattedTextField();
		frmtdtxtfldGuardianId.setFont(new Font("Tahoma", Font.PLAIN, 14));
		frmtdtxtfldGuardianId.setColumns(9);

		lblGuardianId = new JLabel("Guardian's ID:");
		lblGuardianId.setFont(new Font("Tahoma", Font.PLAIN, 14));

		lblGuardiansBillingInformation = new JLabel(
				"Guardian's billing information:");
		lblGuardiansBillingInformation.setFont(new Font("Tahoma", Font.PLAIN,
				14));

		frmtdtxtfldGuardianBillingInfo = new JTextField();
		frmtdtxtfldGuardianBillingInfo.setFont(new Font("Tahoma", Font.PLAIN,
				14));
		frmtdtxtfldGuardianBillingInfo.setColumns(9);

		btnGuardianaccept = new JButton("Register");
		btnGuardianaccept.setFont(new Font("Tahoma", Font.PLAIN, 20));
		btnGuardianaccept.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			}
		});
		btnGuardianaccept.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/Login-Registration-icon.png")));

		btnGuardiancancel = new JButton("Back to Menu");
		btnGuardiancancel.setFont(new Font("Tahoma", Font.PLAIN, 20));
		btnGuardiancancel.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/29-House-icon-larger.png")));
		GroupLayout gl_guardinRegistrationPanel = new GroupLayout(
				guardinRegistrationPanel);
		gl_guardinRegistrationPanel
				.setHorizontalGroup(gl_guardinRegistrationPanel
						.createParallelGroup(Alignment.TRAILING)
						.addGroup(
								gl_guardinRegistrationPanel
										.createSequentialGroup()
										.addGroup(
												gl_guardinRegistrationPanel
														.createParallelGroup(
																Alignment.LEADING,
																false)
														.addGroup(
																gl_guardinRegistrationPanel
																		.createSequentialGroup()
																		.addGap(237)
																		.addGroup(
																				gl_guardinRegistrationPanel
																						.createParallelGroup(
																								Alignment.LEADING)
																						.addComponent(
																								lblGuardiansBillingInformation)
																						.addComponent(
																								lblGuardianId))
																		.addPreferredGap(
																				ComponentPlacement.RELATED))
														.addGroup(
																Alignment.TRAILING,
																gl_guardinRegistrationPanel
																		.createSequentialGroup()
																		.addContainerGap(
																				GroupLayout.DEFAULT_SIZE,
																				Short.MAX_VALUE)
																		.addComponent(
																				btnGuardianaccept)
																		.addGap(77)))
										.addGroup(
												gl_guardinRegistrationPanel
														.createParallelGroup(
																Alignment.LEADING)
														.addGroup(
																gl_guardinRegistrationPanel
																		.createSequentialGroup()
																		.addGap(113)
																		.addGroup(
																				gl_guardinRegistrationPanel
																						.createParallelGroup(
																								Alignment.LEADING,
																								false)
																						.addComponent(
																								frmtdtxtfldGuardianBillingInfo)
																						.addComponent(
																								frmtdtxtfldGuardianId)))
														.addGroup(
																gl_guardinRegistrationPanel
																		.createSequentialGroup()
																		.addGap(67)
																		.addComponent(
																				btnGuardiancancel)))
										.addContainerGap(145, Short.MAX_VALUE))
						.addGroup(
								gl_guardinRegistrationPanel
										.createSequentialGroup()
										.addContainerGap(207, Short.MAX_VALUE)
										.addComponent(
												lblGuardianRegistrationForm)
										.addGap(190)));
		gl_guardinRegistrationPanel
				.setVerticalGroup(gl_guardinRegistrationPanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_guardinRegistrationPanel
										.createSequentialGroup()
										.addGap(53)
										.addComponent(
												lblGuardianRegistrationForm)
										.addGap(70)
										.addGroup(
												gl_guardinRegistrationPanel
														.createParallelGroup(
																Alignment.TRAILING)
														.addComponent(
																frmtdtxtfldGuardianId,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																lblGuardianId))
										.addGap(59)
										.addGroup(
												gl_guardinRegistrationPanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																frmtdtxtfldGuardianBillingInfo,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																lblGuardiansBillingInformation))
										.addGap(94)
										.addGroup(
												gl_guardinRegistrationPanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																btnGuardianaccept)
														.addComponent(
																btnGuardiancancel))
										.addContainerGap(96, Short.MAX_VALUE)));
		guardinRegistrationPanel.setLayout(gl_guardinRegistrationPanel);

		childRegistrationPanel = new JPanel();
		childRegistrationPanel.setBackground(new Color(255, 228, 225));
		contentPane.add(childRegistrationPanel, "name_5935613071679");

		lblChildRegistrationForm = new JLabel("Child Registration Form");
		lblChildRegistrationForm.setFont(new Font("Tahoma", Font.BOLD, 30));

		lblChildsId = new JLabel("Child's ID:");
		lblChildsId.setFont(new Font("Tahoma", Font.PLAIN, 14));

		lblChildsAge = new JLabel("Child's age:");
		lblChildsAge.setFont(new Font("Tahoma", Font.PLAIN, 14));

		lblChildsHeight = new JLabel("Child's height:");
		lblChildsHeight.setFont(new Font("Tahoma", Font.PLAIN, 14));

		frmtdtxtfldChildId = new JTextField();
		frmtdtxtfldChildId.setFont(new Font("Tahoma", Font.PLAIN, 14));
		frmtdtxtfldChildId.setColumns(9);

		frmtdtxtfldChildsAge = new JTextField();
		frmtdtxtfldChildsAge.setFont(new Font("Tahoma", Font.PLAIN, 14));
		frmtdtxtfldChildsAge.setColumns(9);

		frmtdtxtfldChildsHeight = new JTextField();
		frmtdtxtfldChildsHeight.setFont(new Font("Tahoma", Font.PLAIN, 14));
		frmtdtxtfldChildsHeight.setColumns(9);

		btnRegisterTheChild = new JButton("Register Child");
		btnRegisterTheChild.setFont(new Font("Tahoma", Font.PLAIN, 20));
		btnRegisterTheChild.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/Age-Child-Male-Light-icon.png")));

		btnCancelChildRegistration = new JButton("Cancel");
		btnCancelChildRegistration.setFont(new Font("Tahoma", Font.PLAIN, 20));

		btnCancelChildRegistration.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/14-Delete-icon.png")));
		GroupLayout gl_childRegistrationPanel = new GroupLayout(
				childRegistrationPanel);
		gl_childRegistrationPanel
				.setHorizontalGroup(gl_childRegistrationPanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_childRegistrationPanel
										.createSequentialGroup()
										.addGroup(
												gl_childRegistrationPanel
														.createParallelGroup(
																Alignment.LEADING)
														.addGroup(
																gl_childRegistrationPanel
																		.createSequentialGroup()
																		.addGap(239)
																		.addComponent(
																				lblChildRegistrationForm))
														.addGroup(
																gl_childRegistrationPanel
																		.createSequentialGroup()
																		.addGap(292)
																		.addGroup(
																				gl_childRegistrationPanel
																						.createParallelGroup(
																								Alignment.LEADING)
																						.addComponent(
																								lblChildsId)
																						.addComponent(
																								lblChildsAge)
																						.addComponent(
																								lblChildsHeight))
																		.addGap(74)
																		.addGroup(
																				gl_childRegistrationPanel
																						.createParallelGroup(
																								Alignment.TRAILING)
																						.addComponent(
																								frmtdtxtfldChildId,
																								GroupLayout.PREFERRED_SIZE,
																								GroupLayout.DEFAULT_SIZE,
																								GroupLayout.PREFERRED_SIZE)
																						.addComponent(
																								frmtdtxtfldChildsAge,
																								GroupLayout.PREFERRED_SIZE,
																								GroupLayout.DEFAULT_SIZE,
																								GroupLayout.PREFERRED_SIZE)
																						.addComponent(
																								frmtdtxtfldChildsHeight,
																								GroupLayout.PREFERRED_SIZE,
																								GroupLayout.DEFAULT_SIZE,
																								GroupLayout.PREFERRED_SIZE))))
										.addContainerGap(178, Short.MAX_VALUE))
						.addGroup(
								Alignment.TRAILING,
								gl_childRegistrationPanel
										.createSequentialGroup()
										.addContainerGap(188, Short.MAX_VALUE)
										.addComponent(btnRegisterTheChild)
										.addGap(89)
										.addComponent(
												btnCancelChildRegistration,
												GroupLayout.PREFERRED_SIZE,
												152, GroupLayout.PREFERRED_SIZE)
										.addGap(179)));
		gl_childRegistrationPanel
				.setVerticalGroup(gl_childRegistrationPanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_childRegistrationPanel
										.createSequentialGroup()
										.addGap(58)
										.addComponent(lblChildRegistrationForm)
										.addGap(72)
										.addGroup(
												gl_childRegistrationPanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																lblChildsId)
														.addComponent(
																frmtdtxtfldChildId,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addGap(18)
										.addGroup(
												gl_childRegistrationPanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																lblChildsAge)
														.addComponent(
																frmtdtxtfldChildsAge,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addGap(18)
										.addGroup(
												gl_childRegistrationPanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																lblChildsHeight)
														.addComponent(
																frmtdtxtfldChildsHeight,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addGap(84)
										.addGroup(
												gl_childRegistrationPanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																btnRegisterTheChild,
																GroupLayout.PREFERRED_SIZE,
																53,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																btnCancelChildRegistration,
																GroupLayout.PREFERRED_SIZE,
																51,
																GroupLayout.PREFERRED_SIZE))
										.addContainerGap(87, Short.MAX_VALUE)));
		childRegistrationPanel.setLayout(gl_childRegistrationPanel);

		applicationLoginPanel = new JPanel();
		applicationLoginPanel.setBackground(new Color(144, 238, 144));
		contentPane.add(applicationLoginPanel, "name_17738344335126");

		lblUserApplicationManu = new JLabel("User Application - Login");
		lblUserApplicationManu.setFont(new Font("Tahoma", Font.BOLD, 30));

		btnLogin = new JButton("Login");
		btnLogin.setFont(new Font("Tahoma", Font.PLAIN, 20));
		btnLogin.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/System-Login-icon.png")));

		lblUserId = new JLabel("User ID:");
		lblUserId.setFont(new Font("Tahoma", Font.PLAIN, 14));

		lblUserPassword = new JLabel("User Password:");
		lblUserPassword.setFont(new Font("Tahoma", Font.PLAIN, 14));

		txtUserPassword = new JTextField();
		txtUserPassword.setFont(new Font("Tahoma", Font.PLAIN, 14));
		txtUserPassword.setColumns(9);

		frmtdtxtfldUserid = new JTextField();
		frmtdtxtfldUserid.setFont(new Font("Tahoma", Font.PLAIN, 14));
		frmtdtxtfldUserid.setColumns(9);

		btnBackToManu_1 = new JButton("Back to Menu");
		btnBackToManu_1.setFont(new Font("Tahoma", Font.PLAIN, 20));
		btnBackToManu_1.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/29-House-icon-larger.png")));
		GroupLayout gl_applicationLoginPanel = new GroupLayout(
				applicationLoginPanel);
		gl_applicationLoginPanel
				.setHorizontalGroup(gl_applicationLoginPanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_applicationLoginPanel
										.createSequentialGroup()
										.addGroup(
												gl_applicationLoginPanel
														.createParallelGroup(
																Alignment.LEADING)
														.addGroup(
																gl_applicationLoginPanel
																		.createSequentialGroup()
																		.addGap(205)
																		.addComponent(
																				lblUserApplicationManu))
														.addGroup(
																gl_applicationLoginPanel
																		.createSequentialGroup()
																		.addGap(243)
																		.addGroup(
																				gl_applicationLoginPanel
																						.createParallelGroup(
																								Alignment.LEADING)
																						.addComponent(
																								lblUserPassword)
																						.addComponent(
																								lblUserId))
																		.addGap(59)
																		.addGroup(
																				gl_applicationLoginPanel
																						.createParallelGroup(
																								Alignment.TRAILING)
																						.addComponent(
																								frmtdtxtfldUserid,
																								GroupLayout.PREFERRED_SIZE,
																								GroupLayout.DEFAULT_SIZE,
																								GroupLayout.PREFERRED_SIZE)
																						.addComponent(
																								txtUserPassword,
																								GroupLayout.PREFERRED_SIZE,
																								GroupLayout.DEFAULT_SIZE,
																								GroupLayout.PREFERRED_SIZE)))
														.addGroup(
																gl_applicationLoginPanel
																		.createSequentialGroup()
																		.addGap(180)
																		.addComponent(
																				btnLogin)
																		.addGap(112)
																		.addComponent(
																				btnBackToManu_1)))
										.addContainerGap(207, Short.MAX_VALUE)));
		gl_applicationLoginPanel
				.setVerticalGroup(gl_applicationLoginPanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_applicationLoginPanel
										.createSequentialGroup()
										.addGap(80)
										.addComponent(lblUserApplicationManu)
										.addPreferredGap(
												ComponentPlacement.RELATED, 80,
												Short.MAX_VALUE)
										.addGroup(
												gl_applicationLoginPanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(lblUserId)
														.addComponent(
																frmtdtxtfldUserid,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addGap(54)
										.addGroup(
												gl_applicationLoginPanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																lblUserPassword)
														.addComponent(
																txtUserPassword,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addGap(76)
										.addGroup(
												gl_applicationLoginPanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(btnLogin)
														.addComponent(
																btnBackToManu_1,
																GroupLayout.PREFERRED_SIZE,
																53,
																GroupLayout.PREFERRED_SIZE))
										.addGap(66)));
		applicationLoginPanel.setLayout(gl_applicationLoginPanel);

		applicationMenuPanel = new JPanel();
		applicationMenuPanel.setBackground(new Color(144, 238, 144));
		contentPane.add(applicationMenuPanel, "name_21267964595582");

		lblDisplayChildrenInRides = new JLabel(
				"Choose Ride to Display Children");
		lblDisplayChildrenInRides.setFont(new Font("Tahoma", Font.BOLD, 30));

		btnReturnFromApp = new JButton("Back to Menu");
		btnReturnFromApp.setFont(new Font("Tahoma", Font.PLAIN, 20));

		btnReturnFromApp.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/29-House-icon-larger.png")));

		scrollPaneChildrenInRides = new JScrollPane();

		btnDisplayChildren = new JButton("Display Children");
		btnDisplayChildren.setFont(new Font("Tahoma", Font.PLAIN, 20));

		btnDisplayChildren.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/Age-Child-Male-Light-icon.png")));
		GroupLayout gl_applicationMenuPanel = new GroupLayout(
				applicationMenuPanel);
		gl_applicationMenuPanel
				.setHorizontalGroup(gl_applicationMenuPanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_applicationMenuPanel
										.createSequentialGroup()
										.addGroup(
												gl_applicationMenuPanel
														.createParallelGroup(
																Alignment.LEADING)
														.addGroup(
																gl_applicationMenuPanel
																		.createSequentialGroup()
																		.addGap(184)
																		.addComponent(
																				lblDisplayChildrenInRides))
														.addGroup(
																gl_applicationMenuPanel
																		.createSequentialGroup()
																		.addGap(173)
																		.addComponent(
																				btnDisplayChildren)
																		.addGap(64)
																		.addComponent(
																				btnReturnFromApp))
														.addGroup(
																gl_applicationMenuPanel
																		.createSequentialGroup()
																		.addGap(43)
																		.addComponent(
																				scrollPaneChildrenInRides,
																				GroupLayout.PREFERRED_SIZE,
																				743,
																				GroupLayout.PREFERRED_SIZE)))
										.addContainerGap(29, Short.MAX_VALUE)));
		gl_applicationMenuPanel
				.setVerticalGroup(gl_applicationMenuPanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_applicationMenuPanel
										.createSequentialGroup()
										.addGap(54)
										.addComponent(lblDisplayChildrenInRides)
										.addGap(32)
										.addComponent(
												scrollPaneChildrenInRides,
												GroupLayout.PREFERRED_SIZE,
												270, GroupLayout.PREFERRED_SIZE)
										.addGap(18)
										.addGroup(
												gl_applicationMenuPanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																btnReturnFromApp,
																GroupLayout.DEFAULT_SIZE,
																57,
																Short.MAX_VALUE)
														.addComponent(
																btnDisplayChildren))
										.addGap(28)));
		applicationMenuPanel.setLayout(gl_applicationMenuPanel);

		childETicketPanel = new JPanel();
		childETicketPanel.setBackground(new Color(144, 238, 144));
		contentPane.add(childETicketPanel, "name_26430626379286");

		lblBuyingCanceling = new JLabel("Child's E-Ticket");
		lblBuyingCanceling.setFont(new Font("Tahoma", Font.BOLD, 30));

		scrollChildETicket = new JScrollPane();

		btnButTicket = new JButton("Buy Ticket");
		btnButTicket.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			}
		});
		btnButTicket.setFont(new Font("Tahoma", Font.PLAIN, 20));
		btnButTicket.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/add-icon (1).png")));

		btnRemoveTicket = new JButton("Remove Ticket");
		btnRemoveTicket.setFont(new Font("Tahoma", Font.PLAIN, 20));

		btnRemoveTicket.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/14-Delete-icon.png")));

		txtChildsAge = new JTextField();
		txtChildsAge.setFont(new Font("Tahoma", Font.PLAIN, 14));
		txtChildsAge.setEditable(false);
		txtChildsAge.setColumns(10);

		JLabel lblYouChildsAge = new JLabel("your child's age:");
		lblYouChildsAge.setFont(new Font("Tahoma", Font.PLAIN, 14));

		JLabel lblYourChildsHeight = new JLabel("your child's height:");
		lblYourChildsHeight.setFont(new Font("Tahoma", Font.PLAIN, 14));

		txtChildHeight = new JTextField();
		txtChildHeight.setFont(new Font("Tahoma", Font.PLAIN, 14));
		txtChildHeight.setEditable(false);
		txtChildHeight.setColumns(10);

		lblYourChildsId = new JLabel("your child's ID:");
		lblYourChildsId.setFont(new Font("Tahoma", Font.PLAIN, 14));

		textChosenChildID = new JTextField();
		textChosenChildID.setFont(new Font("Tahoma", Font.PLAIN, 14));
		textChosenChildID.setEditable(false);
		textChosenChildID.setColumns(10);

		btnBackToChosen = new JButton("Back to Menu");
		btnBackToChosen.setFont(new Font("Tahoma", Font.PLAIN, 20));

		btnBackToChosen.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/29-House-icon.png")));

		JLabel lblRegularRidesPrice = new JLabel("Regular Ride's Price : 10$");
		lblRegularRidesPrice.setFont(new Font("Tahoma", Font.BOLD, 14));

		JLabel lblExtremeRidesPrice = new JLabel("Extreme Ride's Price : 15$");
		lblExtremeRidesPrice.setFont(new Font("Tahoma", Font.BOLD, 14));
		GroupLayout gl_childETicketPanel = new GroupLayout(childETicketPanel);
		gl_childETicketPanel.setHorizontalGroup(
			gl_childETicketPanel.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_childETicketPanel.createSequentialGroup()
					.addGroup(gl_childETicketPanel.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_childETicketPanel.createSequentialGroup()
							.addGroup(gl_childETicketPanel.createParallelGroup(Alignment.LEADING)
								.addGroup(gl_childETicketPanel.createSequentialGroup()
									.addGap(74)
									.addComponent(btnButTicket)
									.addPreferredGap(ComponentPlacement.RELATED, 213, Short.MAX_VALUE)
									.addComponent(btnRemoveTicket))
								.addGroup(gl_childETicketPanel.createSequentialGroup()
									.addContainerGap()
									.addComponent(scrollChildETicket, GroupLayout.PREFERRED_SIZE, 623, GroupLayout.PREFERRED_SIZE)))
							.addPreferredGap(ComponentPlacement.RELATED)
							.addGroup(gl_childETicketPanel.createParallelGroup(Alignment.LEADING)
								.addComponent(txtChildsAge, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
								.addComponent(textChosenChildID, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
								.addComponent(txtChildHeight, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
								.addComponent(lblYourChildsId, GroupLayout.PREFERRED_SIZE, 160, GroupLayout.PREFERRED_SIZE)
								.addComponent(lblYouChildsAge, GroupLayout.PREFERRED_SIZE, 140, GroupLayout.PREFERRED_SIZE)
								.addComponent(lblYourChildsHeight, GroupLayout.PREFERRED_SIZE, 149, GroupLayout.PREFERRED_SIZE)))
						.addGroup(gl_childETicketPanel.createSequentialGroup()
							.addGap(23)
							.addGroup(gl_childETicketPanel.createParallelGroup(Alignment.LEADING, false)
								.addComponent(lblRegularRidesPrice)
								.addComponent(lblExtremeRidesPrice, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)))
						.addGroup(gl_childETicketPanel.createSequentialGroup()
							.addGap(251)
							.addComponent(lblBuyingCanceling, GroupLayout.PREFERRED_SIZE, 273, GroupLayout.PREFERRED_SIZE)))
					.addContainerGap(16, Short.MAX_VALUE))
				.addGroup(gl_childETicketPanel.createSequentialGroup()
					.addGap(243)
					.addComponent(btnBackToChosen)
					.addContainerGap(391, Short.MAX_VALUE))
		);
		gl_childETicketPanel.setVerticalGroup(
			gl_childETicketPanel.createParallelGroup(Alignment.TRAILING)
				.addGroup(gl_childETicketPanel.createSequentialGroup()
					.addGap(16)
					.addComponent(lblBuyingCanceling, GroupLayout.PREFERRED_SIZE, 39, GroupLayout.PREFERRED_SIZE)
					.addGap(11)
					.addComponent(lblExtremeRidesPrice)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(lblRegularRidesPrice)
					.addGap(18)
					.addGroup(gl_childETicketPanel.createParallelGroup(Alignment.TRAILING)
						.addGroup(gl_childETicketPanel.createSequentialGroup()
							.addComponent(lblYourChildsId)
							.addPreferredGap(ComponentPlacement.RELATED)
							.addComponent(textChosenChildID, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(ComponentPlacement.RELATED, 38, Short.MAX_VALUE)
							.addComponent(lblYouChildsAge)
							.addPreferredGap(ComponentPlacement.RELATED)
							.addComponent(txtChildsAge, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
							.addGap(37)
							.addComponent(lblYourChildsHeight)
							.addPreferredGap(ComponentPlacement.UNRELATED)
							.addComponent(txtChildHeight, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
						.addComponent(scrollChildETicket, GroupLayout.DEFAULT_SIZE, 218, Short.MAX_VALUE))
					.addGap(33)
					.addGroup(gl_childETicketPanel.createParallelGroup(Alignment.BASELINE)
						.addComponent(btnButTicket)
						.addComponent(btnRemoveTicket))
					.addGap(18)
					.addComponent(btnBackToChosen)
					.addGap(37))
		);
		childETicketPanel.setLayout(gl_childETicketPanel);

		mainRidePanel = new JPanel();
		mainRidePanel.setBackground(new Color(204, 204, 255));
		contentPane.add(mainRidePanel, "name_7995445217680");

		lblChoose = new JLabel("Choose a Ride to Enter\\Exit");
		lblChoose.setFont(new Font("Tahoma", Font.BOLD, 30));

		enterRideScrollPanal = new JScrollPane();

		btnExitRide = new JButton("Exit Ride");
		btnExitRide.setFont(new Font("Tahoma", Font.PLAIN, 20));

		btnExitRide.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/System-Logout-icon.png")));

		btnRetun = new JButton("Back to Menu");
		btnRetun.setFont(new Font("Tahoma", Font.PLAIN, 20));
		btnRetun.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/29-House-icon-large.png")));

		btnEnterRide = new JButton("Enter Ride");
		btnEnterRide.setFont(new Font("Tahoma", Font.PLAIN, 20));

		btnEnterRide.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/System-Login-icon.png")));

		textChildID = new JTextField();
		textChildID.setFont(new Font("Tahoma", Font.PLAIN, 14));
		textChildID.setColumns(10);

		lblChildID = new JLabel("Child ID:");
		lblChildID.setFont(new Font("Tahoma", Font.PLAIN, 14));
		GroupLayout gl_mainRidePanel = new GroupLayout(mainRidePanel);
		gl_mainRidePanel
				.setHorizontalGroup(gl_mainRidePanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_mainRidePanel
										.createSequentialGroup()
										.addGroup(
												gl_mainRidePanel
														.createParallelGroup(
																Alignment.LEADING,
																false)
														.addGroup(
																gl_mainRidePanel
																		.createSequentialGroup()
																		.addGap(93)
																		.addComponent(
																				btnEnterRide)
																		.addGap(18)
																		.addComponent(
																				btnExitRide)
																		.addPreferredGap(
																				ComponentPlacement.RELATED,
																				GroupLayout.DEFAULT_SIZE,
																				Short.MAX_VALUE)
																		.addComponent(
																				btnRetun,
																				GroupLayout.PREFERRED_SIZE,
																				222,
																				GroupLayout.PREFERRED_SIZE))
														.addGroup(
																gl_mainRidePanel
																		.createSequentialGroup()
																		.addGap(190)
																		.addComponent(
																				lblChoose))
														.addGroup(
																gl_mainRidePanel
																		.createSequentialGroup()
																		.addGap(294)
																		.addComponent(
																				lblChildID)
																		.addGap(41)
																		.addComponent(
																				textChildID,
																				GroupLayout.PREFERRED_SIZE,
																				121,
																				GroupLayout.PREFERRED_SIZE))
														.addGroup(
																gl_mainRidePanel
																		.createSequentialGroup()
																		.addGap(30)
																		.addComponent(
																				enterRideScrollPanal,
																				GroupLayout.PREFERRED_SIZE,
																				762,
																				GroupLayout.PREFERRED_SIZE)))
										.addContainerGap(23,
												GroupLayout.PREFERRED_SIZE)));
		gl_mainRidePanel
				.setVerticalGroup(gl_mainRidePanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_mainRidePanel
										.createSequentialGroup()
										.addGap(32)
										.addComponent(lblChoose)
										.addGap(37)
										.addComponent(enterRideScrollPanal,
												GroupLayout.PREFERRED_SIZE,
												232, GroupLayout.PREFERRED_SIZE)
										.addGap(18)
										.addGroup(
												gl_mainRidePanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																lblChildID)
														.addComponent(
																textChildID,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addGap(23)
										.addGroup(
												gl_mainRidePanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																btnEnterRide)
														.addComponent(
																btnExitRide)
														.addComponent(btnRetun))
										.addContainerGap(37, Short.MAX_VALUE)));
		mainRidePanel.setLayout(gl_mainRidePanel);

		applicationChoice = new JPanel();
		applicationChoice.setBackground(new Color(144, 238, 144));
		contentPane.add(applicationChoice, "name_42478518746826");

		label_1 = new JLabel("");

		label_2 = new JLabel("");

		lblDisplayChildrenOr = new JLabel("Display Children or Buy Ticket");
		lblDisplayChildrenOr.setHorizontalAlignment(SwingConstants.CENTER);
		lblDisplayChildrenOr.setFont(new Font("Tahoma", Font.BOLD, 30));

		btnDisplayChildrenIn = new JButton("Display Children In Rides");
		btnDisplayChildrenIn.setFont(new Font("Tahoma", Font.PLAIN, 20));

		btnDisplayChildrenIn.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/Age-Child-Male-Light-icon.png")));

		btnBuyTicketsFor = new JButton("Buy Tickets For Child");
		btnBuyTicketsFor.setFont(new Font("Tahoma", Font.PLAIN, 20));

		btnBuyTicketsFor.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/Games1-icon.png")));

		btnReturnMenu = new JButton("Logout");
		btnReturnMenu.setFont(new Font("Tahoma", Font.PLAIN, 20));

		btnReturnMenu.setIcon(new ImageIcon(MainGui.class
				.getResource("/resources/System-Logout-icon.png")));
		GroupLayout gl_applicationChoice = new GroupLayout(applicationChoice);
		gl_applicationChoice
				.setHorizontalGroup(gl_applicationChoice
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_applicationChoice
										.createSequentialGroup()
										.addGroup(
												gl_applicationChoice
														.createParallelGroup(
																Alignment.LEADING)
														.addComponent(
																label_1,
																GroupLayout.PREFERRED_SIZE,
																389,
																GroupLayout.PREFERRED_SIZE)
														.addGroup(
																gl_applicationChoice
																		.createSequentialGroup()
																		.addGap(192)
																		.addComponent(
																				lblDisplayChildrenOr,
																				GroupLayout.PREFERRED_SIZE,
																				468,
																				GroupLayout.PREFERRED_SIZE)))
										.addGap(953)
										.addComponent(label_2,
												GroupLayout.PREFERRED_SIZE,
												398, GroupLayout.PREFERRED_SIZE))
						.addGroup(
								gl_applicationChoice
										.createSequentialGroup()
										.addGap(90)
										.addComponent(btnDisplayChildrenIn)
										.addGap(63)
										.addComponent(btnBuyTicketsFor,
												GroupLayout.PREFERRED_SIZE,
												280, GroupLayout.PREFERRED_SIZE))
						.addGroup(
								gl_applicationChoice
										.createSequentialGroup()
										.addGap(338)
										.addComponent(btnReturnMenu,
												GroupLayout.PREFERRED_SIZE,
												183, GroupLayout.PREFERRED_SIZE)));
		gl_applicationChoice
				.setVerticalGroup(gl_applicationChoice
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_applicationChoice
										.createSequentialGroup()
										.addGroup(
												gl_applicationChoice
														.createParallelGroup(
																Alignment.LEADING)
														.addGroup(
																gl_applicationChoice
																		.createSequentialGroup()
																		.addComponent(
																				label_1,
																				GroupLayout.PREFERRED_SIZE,
																				96,
																				GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				ComponentPlacement.UNRELATED)
																		.addComponent(
																				lblDisplayChildrenOr,
																				GroupLayout.PREFERRED_SIZE,
																				124,
																				GroupLayout.PREFERRED_SIZE))
														.addComponent(
																label_2,
																GroupLayout.PREFERRED_SIZE,
																225,
																GroupLayout.PREFERRED_SIZE))
										.addGap(53)
										.addGroup(
												gl_applicationChoice
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																btnDisplayChildrenIn)
														.addComponent(
																btnBuyTicketsFor,
																GroupLayout.PREFERRED_SIZE,
																55,
																GroupLayout.PREFERRED_SIZE))
										.addGap(61)
										.addComponent(btnReturnMenu,
												GroupLayout.PREFERRED_SIZE, 55,
												GroupLayout.PREFERRED_SIZE)
										.addGap(39)));
		applicationChoice.setLayout(gl_applicationChoice);

		invalidInputDialog = new JOptionPane();
		timerLabelList = new LinkedList<JLabel>();

	}

	private void createEvents() {
		btnCreateRide.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				supervisorMainPanel.setVisible(false);

				createRidePanel.setVisible(true);
			}
		});

		btnCancel.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				txtName.setText("");
				frmtdtxtfldMaxCapacity.setText("");
				frmtdtxtfldMinAge.setText("");
				frmtdtxtfldMinHeight.setText("");
				createRidePanel.setVisible(false);
				supervisorMainPanel.setVisible(true);
			}
		});

		btnSupervisorStation.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				mainPanel.setVisible(false);
				supervisorMainPanel.setVisible(true);
			}
		});

		btnBackToManu.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				supervisorMainPanel.setVisible(false);
				mainPanel.setVisible(true);
			}
		});

		btnAccept.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				try {
					rideCreationHandler();
				} catch (Exception e1) {
					e1.printStackTrace();
				}
			}
		});

		rdbtnYes.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				isExtreme = true;
			}
		});

		rdbtnNo.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				isExtreme = false;
			}
		});

		btnEditridecancel.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				frmtdtxtfldSupervisorRideID.setText("");
				frmtdtxtfldRidesNewCapacity.setText("");
				frmtdtxtfldRidesNewAge.setText("");
				frmtdtxtfldRidesNewHeight.setText("");
				editRidePanel.setVisible(false);
				supervisorMainPanel.setVisible(true);
			}
		});

		btnEditRide.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				supervisorMainPanel.setVisible(false);
				editRidePanel.setVisible(true);
			}
		});

		btnRegistration.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				mainPanel.setVisible(false);
				guardinRegistrationPanel.setVisible(true);
			}
		});

		btnGuardiancancel.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				frmtdtxtfldGuardianId.setText("");
				frmtdtxtfldGuardianBillingInfo.setText("");
				guardinRegistrationPanel.setVisible(false);
				mainPanel.setVisible(true);
			}
		});

		btnGuardianaccept.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				try {
					guardianRegistrationHandler();
				} catch (Exception e2) {
					e2.printStackTrace();
				}
			}
		});

		btnRegisterTheChild.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				childRegistrationHandler();
			}
		});

		btnEditrideaccept.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				editRideHandler();
			}
		});

		btnBackToManu_1.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				txtUserPassword.setText("");
				frmtdtxtfldUserid.setText("");
				applicationLoginPanel.setVisible(false);
				mainPanel.setVisible(true);
			}
		});

		btnGoToApplication.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				mainPanel.setVisible(false);
				applicationLoginPanel.setVisible(true);
			}
		});

		btnLogin.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				loginHandler();
			}
		});

		btnDisplayRidesStatistics.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				int numOfFields = 3;
				LinkedList<RideEntry> entries = centralComputer
						.getRidesCatalog();
				HashMap<Integer, Integer> rideStatistics = supervisor
						.getTicketsAmount();
				String[] columnNames = { "Ride's ID", "Ride's Name",
						"Amount of tickets" };
				int numOfRows = entries.size() + DEFAULT_TABLE_SIZE;
				Object[][] data = new Object[numOfRows][numOfFields];
				initSupervisotTbl(data, numOfRows);
				int i = 0;
				for (RideEntry rideEntry : entries) {
					int ID = rideEntry.getRideID();
					data[i][0] = ID;
					data[i][1] = rideEntry.getRideName();
					if (rideStatistics.containsKey(ID)) {
						data[i][2] = rideStatistics.get(ID);
					} else {
						data[i][2] = 0;
					}
					i++;
				}

				statisticsTable = new JTable(data, columnNames) {
					private static final long serialVersionUID = 1L;

					public boolean isCellEditable(int row, int column) {
						return false;
					};
				};

				// statisticsTable = new JTable(data, columnNames);
				supervisorScrollPane.setViewportView(statisticsTable);
				supervisorMainPanel.setVisible(false);
				displayTicketsPerRidePanel.setVisible(true);
			}
		});

		btnReturn.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				displayTicketsPerRidePanel.setVisible(false);
				supervisorMainPanel.setVisible(true);
			}
		});

		btnGoToRide.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				int numOfFields = 4;
				String[] columnNames = { "Ride's ID", "Ride's name",
						"Ride's age limitation", "Ride's height limitation" };
				// LinkedList<IRide> rides = filterOpenRides();
				LinkedList<IRide> rides = centralComputer.getRidesList();
				if (rides.size() == 0) {
					showEntranceError();
				} else {
					int numOfRows = DEFAULT_TABLE_SIZE + rides.size();
					Object[][] data = new Object[numOfRows][numOfFields];
					initEnterRideTbl(data, numOfRows);
					int i = 0;
					for (IRide iRide : rides) {
						data[i][0] = iRide.getRideID();
						data[i][1] = iRide.getRideName();
						data[i][2] = iRide.getMinimumAge();
						data[i][3] = iRide.getMinimumHeight();
						i++;
					}

					statisticsTable = new JTable(data, columnNames) {
						private static final long serialVersionUID = 1L;

						public boolean isCellEditable(int row, int column) {
							return false;
						};
					};

					// statisticsTable = new JTable(data, columnNames);
					enterRideScrollPanal.setViewportView(statisticsTable);
					// OLDrideMainPanel.setVisible(false);
					mainRidePanel.setVisible(true);
				}
				mainPanel.setVisible(false);
				mainRidePanel.setVisible(true);
			}
		});

		btnRetun.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				textChildID.setText("");
				mainRidePanel.setVisible(false);
				mainPanel.setVisible(true);
			}
		});

		btnEnterRide.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				int rideSelection = 0;
				if (isValidSelection(statisticsTable.getRowCount())) {
					rideSelection = getRowSelection(statisticsTable
							.getRowCount());
				} else {
					return;
				}
				rideID = Integer.parseInt((statisticsTable.getValueAt(
						rideSelection, 0)).toString());

				if (!isValidChildID()) {
					return;
				}

				try {
					// Exception caught
					if (childEnteringRideProcess()) {
						return;
					}
				} catch (RideInactiveException | ChildNotInRideException
						| InvalidRideId e1) {
					return;
				}

				textChildID.setText("");
				mainRidePanel.setVisible(false);
				mainPanel.setVisible(true);
				// rideEnteredPanel.setVisible(true);
				// System.out.println(rideID); //TODO: DELETE ME!!!
			}

		});

		btnExitRide.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				int rideSelection = 0;
				if (isValidSelection(statisticsTable.getRowCount())) {
					rideSelection = getRowSelection(statisticsTable
							.getRowCount());
				} else {
					return;
				}
				rideID = Integer.parseInt((statisticsTable.getValueAt(
						rideSelection, 0)).toString());

				if (!isValidChildID()) {
					return;
				}

				try {
					if (childExitingRideProcess()) {
						return;
					}
				} catch (RideActiveException | ChildNotInRideException
						| InvalidRideId | ChildHeightDoesntMatch
						| ChildAgeDoesntMatch | ChildDoesntHaveTicket
						| RideIDDoesntExist | TicketDoesntExist e) {
					return;
				}
				textChildID.setText("");
				mainRidePanel.setVisible(false);
				mainPanel.setVisible(true);
			}

		});

		btnCancelChildRegistration.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				
				if (cancelChildAndGuardianRegistration()) {
					return;
				}
				
				frmtdtxtfldChildId.setText("");
				frmtdtxtfldChildsAge.setText("");
				frmtdtxtfldChildsHeight.setText("");
				childRegistrationPanel.setVisible(false);
				mainPanel.setVisible(true);
			}


		});

		btnReturnFromApp.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				applicationMenuPanel.setVisible(false);
				applicationChoice.setVisible(true);
			}

		});

		btnReturnMenu.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				logoutApplication();
				applicationChoice.setVisible(false);
				applicationLoginPanel.setVisible(true);
			}

		});

		btnDisplayChildrenIn.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {

				// chooseCildrenComboBox();
				int numOfFields = 5;
				String[] columnNames = { "Ride's ID", "Ride's name",
						"Ride's age limitation", "Ride's height limitation",
						"Number of children in ride" };
				// LinkedList<IRide> rides = filterOpenRides();
				LinkedList<IRide> rides = centralComputer.getRidesList();
				if (rides.size() == 0) {
					showEntranceError();
				} else {
					int numOfRows = DEFAULT_TABLE_SIZE + rides.size();
					Object[][] data = new Object[numOfRows][numOfFields];
					initEnterRideTbl(data, numOfRows);
					int i = 0;
					for (IRide iRide : rides) {
						data[i][0] = iRide.getRideID();
						data[i][1] = iRide.getRideName();
						data[i][2] = iRide.getMinimumAge();
						data[i][3] = iRide.getMinimumHeight();
						data[i][4] = "";
						i++;
					}

					GuardianEntry currentGuardian = null;
					for (GuardianEntry g : centralComputer.getGuardiansList()) {
						if (g.getID().equals(guardianID)) {
							currentGuardian = g;
						}
					}

					if (currentGuardian == null) {
						return;
					}

					LinkedList<ChildEntry> guardianChildrenList = currentGuardian
							.getChildrenList();

					i = 0;
					for (IRide r : rides) {
						int childrenNumber = 0;
						for (ChildEntry c : guardianChildrenList) {
							if (c.getRideID().equals(r.getRideID())) {
								childrenNumber++;
							}
						}
						data[i][4] = Integer.toString(childrenNumber);
						i++;
					}

					statisticsTable = new JTable(data, columnNames) {
						private static final long serialVersionUID = 1L;

						public boolean isCellEditable(int row, int column) {
							return false;
						};
					};
					// statisticsTable = new JTable(data, columnNames);
					scrollPaneChildrenInRides.setViewportView(statisticsTable);
					// OLDrideMainPanel.setVisible(false);
					// mainRidePanel.setVisible(true);
				}
				applicationChoice.setVisible(false);
				applicationMenuPanel.setVisible(true);

			}

		});

		btnBuyTicketsFor.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				// System.out.println(guardianID.toString());
				GuardianEntry currentGuardian = null;
				for (GuardianEntry g : centralComputer.getGuardiansList()) {
					if (guardianID.equals(g.getID())) {
						currentGuardian = g;
					}
				}

				LinkedList<ChildEntry> childrenOfCurrentGuardian = currentGuardian
						.getChildrenList();

				if (childrenOfCurrentGuardian.size() == 0) {
					noChildrenMessage();
					return;
				}

				JPanel panel = new JPanel();
				panel.add(new JLabel("Please make a selection:"));
				DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>();

				for (ChildEntry c : childrenOfCurrentGuardian) {
					model.addElement(c.getID().toString());
				}

				JComboBox<String> comboBox = new JComboBox<String>(model);
				panel.add(comboBox);

				int result = JOptionPane.showConfirmDialog(null, panel,
						"Buy Ticket", JOptionPane.OK_CANCEL_OPTION,
						JOptionPane.QUESTION_MESSAGE);
				if (result == JOptionPane.CANCEL_OPTION
						|| result == JOptionPane.CLOSED_OPTION) {
					return;
				}

				chosenChild = (String) comboBox.getSelectedItem();
				// System.out.println(chosenChild);

				ChildEntry chosen = null;
				for (ChildEntry c : childrenOfCurrentGuardian) {
					if (chosenChild.equals(c.getID().toString())) {
						chosen = c;
					}
				}

				txtChildsAge.setText(chosen.getAge().toString());
				txtChildHeight.setText(chosen.getHeight().toString());
				textChosenChildID.setText(chosen.getID().toString());

				int numOfFields = 4;
				String[] columnNames = { "Ride's ID", "Ride's name",
						"Ride's age limitation", "Ride's height limitation" };
				// LinkedList<IRide> rides = filterOpenRides();
				LinkedList<IRide> rides = centralComputer.getRidesList();
				if (rides.size() == 0) {
					showEntranceError();
				} else {
					int numOfRows = DEFAULT_TABLE_SIZE + rides.size();
					Object[][] data = new Object[numOfRows][numOfFields];
					initEnterRideTbl(data, numOfRows);
					int i = 0;
					for (IRide iRide : rides) {
						data[i][0] = iRide.getRideID();
						data[i][1] = iRide.getRideName();
						data[i][2] = iRide.getMinimumAge();
						data[i][3] = iRide.getMinimumHeight();

						i++;
					}

					statisticsTable = new JTable(data, columnNames) {
						private static final long serialVersionUID = 1L;

						public boolean isCellEditable(int row, int column) {
							return false;
						};
					};
					// statisticsTable = new JTable(data, columnNames);

					scrollChildETicket.setViewportView(statisticsTable);
				}
				applicationChoice.setVisible(false);
				childETicketPanel.setVisible(true);

			}

		});

		btnButTicket.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				int rideSelection = 0;
				if (isValidSelection(statisticsTable.getRowCount())) {
					rideSelection = getRowSelection(statisticsTable
							.getRowCount());
				} else {
					return;
				}
				rideID = Integer.parseInt((statisticsTable.getValueAt(
						rideSelection, 0)).toString());

				RideEntry currentRide = null;

				for (RideEntry r : centralComputer.getRidesCatalog()) {
					if (rideID == r.getRideID()) {
						currentRide = r;
					}
				}

				if (currentRide.isExtreme()) {
					if (!extremeRideMessage(currentRide)) {
						return;
					}
				}

				Integer childID = Integer.parseInt(chosenChild);

				try {
					application.buyTicket(rideID, guardianID, childID);
					// centralComputer.buyingProcess(rideID, guardianID,
					// childID);
					billingMessages();

				} catch (InvalidRideId | ChildIDDoesntExist | RideIDDoesntExist
						| GuardianIDDoesntExist | InvalidChildID
						| InvalidGuardianID e1) {
					return;
				}

			}

		});

		btnBackToChosen.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				childETicketPanel.setVisible(false);
				applicationChoice.setVisible(true);
			}
		});

		btnRemoveTicket.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				int rideSelection = 0;
				if (isValidSelection(statisticsTable.getRowCount())) {
					rideSelection = getRowSelection(statisticsTable
							.getRowCount());
				} else {
					return;
				}
				rideID = Integer.parseInt((statisticsTable.getValueAt(
						rideSelection, 0)).toString());

				RideEntry currentRide = null;

				for (RideEntry r : centralComputer.getRidesCatalog()) {
					if (rideID == r.getRideID()) {
						currentRide = r;
					}
				}

				Integer childID = Integer.parseInt(chosenChild);

				if (removeTicketMessage(childID, currentRide.getRideID())) {
					// caught an exception.
					return;
				}

			}

		});

		btnDisplayChildren.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				if (chooseCildrenComboBox()) {
					return;
				}
				applicationMenuPanel.setVisible(false);
				childETicketPanel.setVisible(true);
			}
		});

		// btnExitRide.addMouseListener(new MouseAdapter() {
		// @Override
		// public void mouseClicked(MouseEvent e) {
		// int rideSelection = 0;
		// if (isValidSelection(statisticsTable.getRowCount())) {
		// rideSelection = getRowSelection(statisticsTable
		// .getRowCount());
		// } else {
		// return;
		// }
		// rideID = Integer.parseInt((statisticsTable.getValueAt(
		// rideSelection, 0)).toString());
		// enterRidePanel.setVisible(false);
		// rideEnteredPanel.setVisible(true);
		// // System.out.println(rideID); //TODO: DELETE ME!!!
		// }
		// });
		//
	}

	/***********************************
	 * Private Methods
	 * 
	 * @return
	 *************************************/

	
	private boolean cancelChildAndGuardianRegistration() {
		
		boolean errorCaught = false;
		GuardianEntry curretGuardian = null;
		for (GuardianEntry g : centralComputer.getGuardiansList()) {
			if (g.getID().equals(guardianID)) {
				curretGuardian = g;
			}
		}
		if (curretGuardian == null) {
			errorCaught = true;
			return errorCaught;
		}
		
		if (curretGuardian.getChildrenList().size() == 0) {
			JOptionPane.showMessageDialog(this, "You have to register at least one child.", "ERROR",
					JOptionPane.ERROR_MESSAGE);
			errorCaught = true;
		}
		else {
			JOptionPane.showMessageDialog(this, "Enjoy your time in E-Park!", "Registration Completed",
					JOptionPane.PLAIN_MESSAGE);
		}
		return errorCaught; 
	}
	
	
	
	private void logoutApplication() {
		application.logout();
		guardianID = null;
		JOptionPane.showMessageDialog(this, "Successfuly logged out!", "OK",
				JOptionPane.INFORMATION_MESSAGE);
	}

	private void noChildrenMessage() {
		JOptionPane.showMessageDialog(this, "No children to display.", "ERROR",
				JOptionPane.ERROR_MESSAGE);
		applicationChoice.setVisible(false);
		mainPanel.setVisible(true);
	}

	private boolean chooseCildrenComboBox() {
		boolean exceptionCaught = false;
		Map<Integer, Integer> childrenPositions = null;
		try {
			// key = childID, value = rideID
			// System.out.println(guardianID.toString());
			childrenPositions = application.displayChildrenPosition(guardianID);

		} catch (GuardianIDDoesntExist e1) {
			JOptionPane.showMessageDialog(this,
					"Guardian's ID doesn't exist in the system.", "ERROR",
					JOptionPane.ERROR_MESSAGE);
			exceptionCaught = true;
			return exceptionCaught;
		} catch (NoChildrenForGuardian e1) {
			JOptionPane.showMessageDialog(this, "No children to display.",
					"ERROR", JOptionPane.ERROR_MESSAGE);
			exceptionCaught = true;
			return exceptionCaught;
		} catch (InvalidGuardianID e) {
			exceptionCaught = true;
			return exceptionCaught;
		}

		GuardianEntry currentGuardian = null;
		for (GuardianEntry g : centralComputer.getGuardiansList()) {
			if (guardianID.equals(g.getID())) {
				currentGuardian = g;
			}
		}

		int rideSelection = 0;
		if (isValidSelection(statisticsTable.getRowCount())) {
			rideSelection = getRowSelection(statisticsTable.getRowCount());
		} else {
			exceptionCaught = true;
			return exceptionCaught;
		}
		rideID = Integer
				.parseInt((statisticsTable.getValueAt(rideSelection, 0))
						.toString());

		childrenInRide = new LinkedList<ChildEntry>();

		for (Integer c : childrenPositions.keySet()) {
			if (childrenPositions.get(c).equals(rideID)) {
				for (ChildEntry child : currentGuardian.getChildrenList()) {
					if (child.getID().equals(c)) {
						childrenInRide.add(child);
					}
				}
			}
		}

		if (childrenInRide.size() == 0) {
			JOptionPane.showMessageDialog(this,
					"Non of your children in the ride.", "ERROR",
					JOptionPane.ERROR_MESSAGE);
			exceptionCaught = true;
			return exceptionCaught;

		}

		JPanel panel = new JPanel();
		panel.add(new JLabel(
				"Please make a selection to display child's E-Ticket:"));
		DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>();

		for (ChildEntry c : childrenInRide) {
			model.addElement(c.getID().toString());
		}

		JComboBox<String> comboBox = new JComboBox<String>(model);
		panel.add(comboBox);

		int result = JOptionPane.showConfirmDialog(null, panel,
				"Buy Ticket For Child", JOptionPane.OK_CANCEL_OPTION,
				JOptionPane.QUESTION_MESSAGE);
		chosenChild = (String) comboBox.getSelectedItem();
		if (result == JOptionPane.CANCEL_OPTION
				|| result == JOptionPane.CLOSED_OPTION) {
			exceptionCaught = true;
			return exceptionCaught;
		}
		// System.out.println(chosenChild);

		ChildEntry chosen = null;
		for (ChildEntry c : childrenInRide) {
			if (chosenChild.equals(c.getID().toString())) {
				chosen = c;
			}
		}

		txtChildsAge.setText(chosen.getAge().toString());
		txtChildHeight.setText(chosen.getHeight().toString());
		textChosenChildID.setText(chosen.getID().toString());

		int numOfFields = 4;
		String[] columnNames = { "Ride's ID", "Ride's name",
				"Ride's age limitation", "Ride's height limitation" };
		// LinkedList<IRide> rides = filterOpenRides();
		LinkedList<IRide> rides = centralComputer.getRidesList();
		if (rides.size() == 0) {
			showEntranceError();
		} else {
			int numOfRows = DEFAULT_TABLE_SIZE + rides.size();
			Object[][] data = new Object[numOfRows][numOfFields];
			initEnterRideTbl(data, numOfRows);
			int i = 0;
			for (IRide iRide : rides) {
				data[i][0] = iRide.getRideID();
				data[i][1] = iRide.getRideName();
				data[i][2] = iRide.getMinimumAge();
				data[i][3] = iRide.getMinimumHeight();

				i++;
			}

			statisticsTable = new JTable(data, columnNames) {
				private static final long serialVersionUID = 1L;

				public boolean isCellEditable(int row, int column) {
					return false;
				};
			};
			// statisticsTable = new JTable(data, columnNames);

			scrollChildETicket.setViewportView(statisticsTable);
		}
		return exceptionCaught;
	}

	private ChildEntry findChild(int c) {
		for (ChildEntry child : centralComputer.getChildrenList()) {
			if (child.getID().equals(c)) {
				return child;
			}
		}
		return null;
	}

	private boolean removeTicketMessage(Integer childID, Integer rideId) {
		boolean exceptioncaught = false;
		try {
			// centralComputer.cancelAcquisition(rideId, guardianID, childID);
			application.cancelTicket(rideId, guardianID, childID);
			JOptionPane.showMessageDialog(this, "Ticket removed successfuly.",
					"OK", JOptionPane.INFORMATION_MESSAGE);
			textChildID.setText("");
		} catch (TicketDoesntExist e1) {
			JOptionPane.showMessageDialog(this,
					"The child doesn't have a ticket to this ride.", "ERROR",
					JOptionPane.ERROR_MESSAGE);
			textChildID.setText("");
		} catch (InvalidRideId | ChildIDDoesntExist | RideIDDoesntExist
				| GuardianIDDoesntExist | InvalidGuardianID | InvalidChildID e1) {
			exceptioncaught = true;
		}
		return exceptioncaught;
	}

	private boolean extremeRideMessage(RideEntry currentRide) {
		boolean toProceed = true;
		Object[] options = { "Yes", "No" };
		int userChoice = JOptionPane
				.showOptionDialog(
						this,
						"You chose to buy a ticket to EXTREME ride. Are you sure you want to proceed?",
						"Attention", JOptionPane.OK_CANCEL_OPTION,
						JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
		if (userChoice == EXIT_CHOISE) {
			toProceed = false;
		}
		return toProceed;
	}

	private void billingMessages() {

		Object[] options = { "Yes, let me buy/remove more tickets.",
				"No, I'm done." };
		int userChoice = JOptionPane.showOptionDialog(this,
				"Whould you like to buy/remove more tickets?",
				"Buying succseeded", JOptionPane.YES_NO_OPTION,
				JOptionPane.PLAIN_MESSAGE, null, options, options[1]);
		if (userChoice == EXIT_CHOISE) {
			childETicketPanel.setVisible(false);
			applicationChoice.setVisible(true);
		}

	}

	private boolean childExitingRideProcess() throws RideActiveException,
			ChildNotInRideException, InvalidRideId, ChildHeightDoesntMatch,
			ChildAgeDoesntMatch, ChildDoesntHaveTicket, RideIDDoesntExist,
			TicketDoesntExist {
		boolean exceptionCaught = false;
		int childID = Integer.parseInt(textChildID.getText());

		LinkedList<IRide> ridesList = centralComputer.getRidesList();
		IRide currentRide = null;
		for (IRide r : ridesList) {
			if (rideID == r.getRideID()) {
				currentRide = r;
			}
		}

		IGate currentGate = currentRide.getExitGate();
		try {
			currentGate.passThroughGate(childID);
			JOptionPane.showMessageDialog(this,
					"The child exited successfuly!", "OK",
					JOptionPane.INFORMATION_MESSAGE);
		} catch (RideInactiveException e) {
			JOptionPane.showMessageDialog(this,
					"Can not exit ride while it's running.", "ERROR",
					JOptionPane.ERROR_MESSAGE);
			exceptionCaught = true;
		} catch (InvalidChildID e) {
			JOptionPane.showMessageDialog(this,
					"Invalid child ID. please try again.", "ERROR",
					JOptionPane.ERROR_MESSAGE);
			textChildID.setText("");
			exceptionCaught = true;
		} catch (ChildAlreadyInRideException e) {
			JOptionPane
					.showMessageDialog(
							this,
							"Child already in ride. please exit ride and try again later.",
							"ERROR", JOptionPane.ERROR_MESSAGE);
			textChildID.setText("");
			exceptionCaught = true;
		} catch (ChildIDDoesntExist e) {
			JOptionPane.showMessageDialog(this,
					"Child ID not registred in system.", "ERROR",
					JOptionPane.ERROR_MESSAGE);
			textChildID.setText("");
			exceptionCaught = true;
		}
		return exceptionCaught;

	}

	private boolean childEnteringRideProcess() throws RideInactiveException,
			ChildNotInRideException, InvalidRideId {
		boolean exceptionCaught = false;
		int childID = Integer.parseInt(textChildID.getText());

		LinkedList<IRide> ridesList = centralComputer.getRidesList();
		IRide currentRide = null;
		for (IRide r : ridesList) {
			if (rideID == r.getRideID()) {
				currentRide = r;
			}
		}

		IGate currentGate = currentRide.getEntranceGate();

		try {
			currentGate.passThroughGate(childID);
			JOptionPane.showMessageDialog(this,
					"The child entered successfuly!", "OK",
					JOptionPane.INFORMATION_MESSAGE);

		} catch (RideActiveException e1) {
			JOptionPane.showMessageDialog(this,
					"Can not enter ride while it's running.", "ERROR",
					JOptionPane.ERROR_MESSAGE);
			exceptionCaught = true;
		} catch (InvalidChildID e1) {
			JOptionPane.showMessageDialog(this,
					"Invalid child ID. please try again.", "ERROR",
					JOptionPane.ERROR_MESSAGE);
			textChildID.setText("");
			exceptionCaught = true;
		} catch (ChildAlreadyInRideException e1) {
			JOptionPane
					.showMessageDialog(
							this,
							"Child already in ride. please exit ride and try again later.",
							"ERROR", JOptionPane.ERROR_MESSAGE);
			textChildID.setText("");
			exceptionCaught = true;
		} catch (ChildIDDoesntExist e1) {
			JOptionPane.showMessageDialog(this,
					"Child ID not registred in system.", "ERROR",
					JOptionPane.ERROR_MESSAGE);
			textChildID.setText("");
			exceptionCaught = true;
		} catch (ChildHeightDoesntMatch e1) {
			JOptionPane.showMessageDialog(this,
					"Child's height doesn't match the ride.", "ERROR",
					JOptionPane.ERROR_MESSAGE);
			textChildID.setText("");
			exceptionCaught = true;
		} catch (ChildAgeDoesntMatch e1) {
			JOptionPane.showMessageDialog(this,
					"Child's age doesn't match the ride.", "ERROR",
					JOptionPane.ERROR_MESSAGE);
			textChildID.setText("");
			exceptionCaught = true;
		} catch (ChildDoesntHaveTicket e1) {
			JOptionPane
					.showMessageDialog(
							this,
							"No ticket in the child's E-Ticket. Please purchase a ticket and try again.",
							"ERROR", JOptionPane.ERROR_MESSAGE);
			textChildID.setText("");
			exceptionCaught = true;
		} catch (RideIDDoesntExist e1) {
			JOptionPane.showMessageDialog(this, "Ride doesn't exist.", "ERROR",
					JOptionPane.ERROR_MESSAGE);
			exceptionCaught = true;
		} catch (TicketDoesntExist e1) {
			JOptionPane.showMessageDialog(this, "Ticket doesn't exist.",
					"ERROR", JOptionPane.ERROR_MESSAGE);
			exceptionCaught = true;
		}
		return exceptionCaught;
	}

	private void showExitError() {
		JOptionPane.showMessageDialog(this,
				"There are no rides to exit from.\n"
						+ "Please try again later.");
		mainRidePanel.setVisible(false);
		mainPanel.setVisible(true);
	}

	private void showEntranceError() {
		JOptionPane.showMessageDialog(this, "There are no rides to enter to.\n"
				+ "Please try again later.");
		mainRidePanel.setVisible(false);
		mainPanel.setVisible(true);
	}

	// private void exitingChildHandler() {
	// rideID = (int) statisticsTable.getValueAt(
	// statisticsTable.getSelectedRow(), 0);
	// selectedRide = getRideByID(rideID);
	// Boolean exit = true;
	// Boolean exceptionCought = false;
	// int childID = Integer.parseInt(frmtdtxtfldExitingchildid.getText()
	// .replaceAll(",", ""));
	// try {
	// selectedRide.childExitsRide(childID);
	// } catch (RideInactiveException e2) {
	// // Not able to get here!
	// } catch (InvalidChildID e2) {
	// JOptionPane.showMessageDialog(this,
	// "Entered an Invalid ID, please try again.", "ERROR",
	// JOptionPane.ERROR_MESSAGE);
	// exit = false;
	// exceptionCought = true;
	// } catch (ChildNotInRideException e2) {
	// // TODO: handle exception
	// JOptionPane
	// .showMessageDialog(
	// this,
	// "The ID you entered is not of a child that was inside the ride.",
	// "ERROR", JOptionPane.ERROR_MESSAGE);
	// exceptionCought = true;
	// }
	// if (!exceptionCought) {
	// JOptionPane.showMessageDialog(this, "You have exited the ride!");
	// exit = true;
	// }
	// frmtdtxtfldExitingchildid.setText("");
	// if (exit) {
	// OLDexitRidePanel.setVisible(false);
	// OLDrideMainPanel.setVisible(true);
	// }

	// btnBackRideMenu.addMouseListener(new MouseAdapter() {
	// @Override
	// public void mouseClicked(MouseEvent arg0) {
	// OLDrideEnteredPanel.setVisible(false);
	// OLDrideMainPanel.setVisible(true);
	// }
	// });
	// }

	private boolean isValidChildID() {
		boolean isValid = false;
		try {
			int childID = Integer.parseInt(textChildID.getText());
			isValid = true;
		} catch (NumberFormatException e1) {
			JOptionPane.showMessageDialog(this,
					"Please insert legal child ID.", "ERROR",
					JOptionPane.ERROR_MESSAGE);
			textChildID.setText("");
		}
		return isValid;
	}

	// private boolean isIDValidIDText() {
	// if (frmtdtxtfldExitingchildid.getText().equals("")) {
	// JOptionPane.showMessageDialog(this,
	// "Not entered an ID. Please try again.", "ERROR",
	// JOptionPane.ERROR_MESSAGE);
	// return false;
	// }
	// return true;
	// }

	/**
	 * @param id
	 * @return
	 */
	private IRide getRideByID(int id) {
		for (IRide iRide : centralComputer.getRidesList()) {
			if (iRide.getRideID() == id) {
				return iRide;
			}
		}
		return null;
	}

	/**
	 * @param tblSize
	 * @return
	 */
	private Boolean isValidSelection(int tblSize) {
		Boolean isValid = false;
		int count = 0;
		int rowSelected = 0;
		for (int i = 0; i < tblSize; i++) {
			if (statisticsTable.isRowSelected(i)) {
				rowSelected = i;
				count++;
			}
		}
		if (count == 0) {
			JOptionPane.showMessageDialog(this,
					"Not entered a selection. Please select a ride.", "ERROR",
					JOptionPane.ERROR_MESSAGE);
		} else if (count > 1) {
			JOptionPane
					.showMessageDialog(
							this,
							"Entered multiple rides selections. Please select a single ride.",
							"ERROR", JOptionPane.ERROR_MESSAGE);
		} else if (count == 1
				&& statisticsTable.getValueAt(rowSelected, 0).equals(" ")) {
			JOptionPane.showMessageDialog(this,
					"Not selected a valid ride. Please try again.", "ERROR",
					JOptionPane.ERROR_MESSAGE);
		} else {
			isValid = true;
		}
		return isValid;
	}

	/**
	 * @param tblSize
	 * @return the row that was selected by the user. the row represent the ride
	 *         that was selected from the rides table.
	 */
	private int getRowSelection(int tblSize) {
		int rowSelected = 0;
		for (int i = 0; i < tblSize; i++) {
			if (statisticsTable.isRowSelected(i)) {
				rowSelected = i;
			}
		}
		return rowSelected;
	}

	/**
	 * @return
	 */
	private LinkedList<IRide> filterOpenRides() {
		LinkedList<IRide> filteredRidesList = new LinkedList<IRide>();
		for (IRide iRide : centralComputer.getRidesList()) {
			if (iRide.getState() == RideState.STANDBY
					&& iRide.getEntranceGate().IsGateOpened()) {
				filteredRidesList.add(iRide);
			}
		}
		return filteredRidesList;
	}

	/**
	 * @return
	 */
	private LinkedList<IRide> filterClosedRides() {
		LinkedList<IRide> filteredRidesList = new LinkedList<IRide>();
		for (IRide iRide : centralComputer.getRidesList()) {
			if (iRide.getState() == RideState.STANDBY
					&& iRide.getExitGate().IsGateOpened()) {
				filteredRidesList.add(iRide);
			}
		}
		return filteredRidesList;
	}

	/**
	 * @param data
	 * @param tblSize
	 */
	private void initEnterRideTbl(Object[][] data, int tblSize) {
		for (int i = 0; i < tblSize; i++) {
			data[i][0] = " ";
			data[i][1] = " ";
			data[i][2] = " ";
			data[i][3] = " ";

		}
	}

	/**
	 * @param data
	 * @param tblSize
	 */
	private void initSupervisotTbl(Object[][] data, int tblSize) {
		for (int i = 0; i < tblSize; i++) {
			data[i][0] = " ";
			data[i][1] = " ";
		}
	}

	/**
	 * 
	 */
	private void loginHandler() {
		// TODO Auto-generated method stub
		Boolean exceptionCought = false;
		String error = "An error occured:\n";
		if (frmtdtxtfldUserid.getText().equals("")
				|| txtUserPassword.getText().equals("")) {
			JOptionPane
					.showMessageDialog(
							this,
							"Please enter the your information in the appropriate area.",
							"ERROR", JOptionPane.ERROR_MESSAGE);
		} else {
			Integer userID = null;
			try {
				try {
					userID = Integer.parseInt(frmtdtxtfldUserid.getText()
							.replaceAll(",", ""));
				} catch (NumberFormatException e) {
					JOptionPane.showMessageDialog(this,
							"Invalid user ID. Please try again.", "ERROR",
							JOptionPane.ERROR_MESSAGE);
					frmtdtxtfldUserid.setText("");
					return;
				}
				String password = txtUserPassword.getText();
				application.login(userID, password);
			} catch (ErrorInGuardianPassword e) {
				exceptionCought = true;
				error += "The password entered was incorrect.";
			} catch (GuardianIDDoesntExist e) {
				exceptionCought = true;
				error += "The ID entered isn't of a registered user.";
			} catch (InvalidPassword e) {
				return;
			} catch (InvalidGuardianID e) {
				exceptionCought = true;
				error += "entered illegal ID.";
			}
			if (exceptionCought) {
				JOptionPane.showMessageDialog(this, error, "ERROR",
						JOptionPane.ERROR_MESSAGE);
			} else {
				JOptionPane.showMessageDialog(this, "Welcome user ID: "
						+ userID.toString() + "!");

				// OLDrideMainPanel.setVisible(false);
				// mainRidePanel.setVisible(true);
				guardianID = userID;
				applicationLoginPanel.setVisible(false);
				applicationChoice.setVisible(true);

			}
			txtUserPassword.setText("");
			frmtdtxtfldUserid.setText("");
		}
	}

	private void editRideHandler() {
		if (frmtdtxtfldRidesNewCapacity.getText().equals("")
				|| frmtdtxtfldSupervisorRideID.getText().equals("")
				|| frmtdtxtfldRidesNewAge.getText().equals("")
				|| frmtdtxtfldRidesNewHeight.getText().equals("")) {
			JOptionPane.showMessageDialog(this,
					"Please enter the ride's new data in the specific area.",
					"ERROR", JOptionPane.ERROR_MESSAGE);
			return;
		} else {
			Boolean exceptionCought = false;
			String error = "An error had occured:\n";
			int rideID;
			try {
				rideID = Integer.parseInt(frmtdtxtfldSupervisorRideID.getText()
						.replaceAll(",", ""));
			} catch (NumberFormatException e1) {
				JOptionPane.showMessageDialog(this,
						"Invalid ride ID. Please try again.", "ERROR",
						JOptionPane.ERROR_MESSAGE);
				frmtdtxtfldSupervisorRideID.setText("");
				return;
			}
			int rideMaxCapacity;
			try {
				rideMaxCapacity = Integer.parseInt(frmtdtxtfldRidesNewCapacity
						.getText().replaceAll(",", ""));
			} catch (NumberFormatException e1) {
				JOptionPane.showMessageDialog(this,
						"Invalid ride's capacity. Please try again.", "ERROR",
						JOptionPane.ERROR_MESSAGE);
				frmtdtxtfldRidesNewCapacity.setText("");
				return;
			}
			int rideMinAge;
			try {
				rideMinAge = Integer.parseInt(frmtdtxtfldRidesNewAge.getText()
						.replaceAll(",", ""));
			} catch (NumberFormatException e1) {
				JOptionPane.showMessageDialog(this,
						"Invalid ride's age. Please try again.", "ERROR",
						JOptionPane.ERROR_MESSAGE);
				frmtdtxtfldRidesNewAge.setText("");
				return;
			}
			int rideMinHeight;
			try {
				rideMinHeight = Integer.parseInt(frmtdtxtfldRidesNewHeight
						.getText().replaceAll(",", ""));
			} catch (NumberFormatException e1) {
				JOptionPane.showMessageDialog(this,
						"Invalid ride's height. Please try again.", "ERROR",
						JOptionPane.ERROR_MESSAGE);
				frmtdtxtfldRidesNewHeight.setText("");
				return;
			}
			try {
				supervisor.editRideParams(rideID, rideMaxCapacity, rideMinAge,
						rideMinHeight);
			} catch (InvalidRideId e) {
				exceptionCought = true;
				error += "The ride ID is invalid.";
			} catch (InvalidCapacity e) {
				exceptionCought = true;
				error += "The new maximal capacity is invalid.";
			} catch (InvalidAgeParam e) {
				exceptionCought = true;
				error += "The new minimal age is invalid.";
			} catch (InvalidHeightParam e) {
				exceptionCought = true;
				error += "The new minimal height is invalid.";
			} catch (RideIDDoesntExist e) {
				exceptionCought = true;
				error += "The Ride's ID given isn't registered to the system.";
			} catch (Exception e) {
				JOptionPane.showMessageDialog(this, "ERROR IN PARSING THE XML",
						"ERROR", JOptionPane.ERROR_MESSAGE);
			}
			if (exceptionCought) {
				JOptionPane.showMessageDialog(this, error, "ERROR",
						JOptionPane.ERROR_MESSAGE);
				return;
			} else {
				JOptionPane
						.showMessageDialog(this, "Ride edited successfully!");
				editRidePanel.setVisible(false);
				supervisorMainPanel.setVisible(true);
			}
			frmtdtxtfldSupervisorRideID.setText("");
			frmtdtxtfldRidesNewCapacity.setText("");
			frmtdtxtfldRidesNewAge.setText("");
			frmtdtxtfldRidesNewHeight.setText("");
		}
	}

	private void childRegistrationHandler() {
		// TODO Auto-generated method stub
		Boolean exceptionCought = false;
		String error = "An error had occured:\n";
		if (frmtdtxtfldChildId.getText().equals("")
				|| frmtdtxtfldChildsAge.getText().equals("")
				|| frmtdtxtfldChildsHeight.getText().equals("")) {
			JOptionPane.showMessageDialog(this,
					"Please enter your child's data in the specific area.",
					"ERROR", JOptionPane.ERROR_MESSAGE);
		} else {
			int childID = 0;
			try {
				childID = Integer.parseInt(frmtdtxtfldChildId.getText()
						.replaceAll(",", ""));
			} catch (NumberFormatException e5) {
				JOptionPane.showMessageDialog(this,
						"Invalid child ID. Please try again.", "ERROR",
						JOptionPane.ERROR_MESSAGE);
				frmtdtxtfldChildId.setText("");
				exceptionCought = true;
				return;
			}
			int childAge = 0;
			try {
				childAge = Integer.parseInt(frmtdtxtfldChildsAge.getText()
						.replaceAll(",", ""));
			} catch (NumberFormatException e5) {
				JOptionPane.showMessageDialog(this,
						"Invalid child age. Please try again.", "ERROR",
						JOptionPane.ERROR_MESSAGE);
				frmtdtxtfldChildsAge.setText("");
				exceptionCought = true;
				return;
			}
			int childHeight = 0;
			try {
				childHeight = Integer.parseInt(frmtdtxtfldChildsHeight
						.getText().replaceAll(",", ""));
			} catch (NumberFormatException e5) {
				JOptionPane.showMessageDialog(this,
						"Invalid child height. Please try again.", "ERROR",
						JOptionPane.ERROR_MESSAGE);
				frmtdtxtfldChildsHeight.setText("");
				exceptionCought = true;
				return;
			}
			try {
				centralComputer.addChildToGuardian(guardianID, childID,
						childAge, childHeight);
			} catch (InvalidChildID e) {
				exceptionCought = true;
				error = error + "The child's ID is invalid.\n";
			} catch (InvalidGuardianID e) {
				exceptionCought = true;
				error = error + "The user's ID is invalid.\n";
			} catch (GuardianIDDoesntExist e1) {
				exceptionCought = true;
				error = error + "The user's ID is isn't in the system.\n";
			} catch (InvalidHeightParam e2) {
				exceptionCought = true;
				error = error + "The child's height is invalid.\n";
			} catch (InvalidAgeParam e3) {
				exceptionCought = true;
				error = error + "The child's age is invalid.\n";
			} catch (ChildAlreadyExist e4) {
				exceptionCought = true;
				error = error + "The child's ID is already in the system.\n";
			}
			if (exceptionCought) {
				JOptionPane.showMessageDialog(this, error, "ERROR",
						JOptionPane.ERROR_MESSAGE);
			} else {
				JOptionPane.showMessageDialog(
						this,
						"The child's E-Park ID is: "
								+ Integer.toString(childID));
				Object[] options = { "Yes, let me add more children.",
						"No, i'm done." };
				int userChoice = JOptionPane.showOptionDialog(this,
						"Whould you like register another child?",
						"Registration succseeded", JOptionPane.YES_NO_OPTION,
						JOptionPane.PLAIN_MESSAGE, null, options, options[1]);
				if (userChoice == EXIT_CHOISE) {
					JOptionPane.showMessageDialog(this, "Enjoy your time in E-Park!", "Registration Complete",
							JOptionPane.PLAIN_MESSAGE);
					childRegistrationPanel.setVisible(false);
					mainPanel.setVisible(true);
				}
				
				frmtdtxtfldChildId.setText("");
				frmtdtxtfldChildsAge.setText("");
				frmtdtxtfldChildsHeight.setText("");
			}
		}
	}

	private void guardianRegistrationHandler() {
		Boolean exceptionCought = false;
		String errorStr = "An error had occured:\n";
		if (frmtdtxtfldGuardianId.getText().equals("")
				|| frmtdtxtfldGuardianBillingInfo.getText().equals("")) {
			JOptionPane.showMessageDialog(this,
					"Please enter your data in the specific area.", "ERROR",
					JOptionPane.ERROR_MESSAGE);
		} else {
			String password = new String();
			try {
				guardianID = Integer.parseInt(frmtdtxtfldGuardianId.getText()
						.replaceAll(",", ""));
			} catch (NumberFormatException e) {
				JOptionPane.showMessageDialog(this,
						"Invalid user ID. Please try again.", "ERROR",
						JOptionPane.ERROR_MESSAGE);
				frmtdtxtfldGuardianId.setText("");
				return;
			}
			int billingInfo;
			try {
				billingInfo = Integer.parseInt(frmtdtxtfldGuardianBillingInfo
						.getText().replaceAll(",", ""));
			} catch (NumberFormatException e1) {
				JOptionPane.showMessageDialog(this,
						"Invalid biling info. Please enter a number.", "ERROR",
						JOptionPane.ERROR_MESSAGE);
				frmtdtxtfldGuardianBillingInfo.setText("");
				return;
			}
			try {
				password = centralComputer.addGuardian(guardianID, billingInfo);
			} catch (InvalidGuardianID e) {
				exceptionCought = true;
				errorStr = errorStr + "The guardian ID is invalid.";
			} catch (GuardianAlreadyExist guardianException) {
				exceptionCought = true;
				errorStr = errorStr
						+ "The guardian ID is already in the system.";
			}
			if (exceptionCought) {
				JOptionPane.showMessageDialog(this, errorStr, "ERROR",
						JOptionPane.ERROR_MESSAGE);
			} else {
				JOptionPane.showMessageDialog(this,
						"Guardian added successfully!\n"
								+ "Your new password is: " + password);
				guardinRegistrationPanel.setVisible(false);
				childRegistrationPanel.setVisible(true);
			}
			frmtdtxtfldGuardianId.setText("");
			frmtdtxtfldGuardianBillingInfo.setText("");
		}

	}

	private void rideCreationHandler() throws Exception {
		String errorStr = "There are errors in the fields:\n";
		LinkedList<String> errors = new LinkedList<String>();
		String rideName = txtName.getText();
		Integer rideID;
		if (txtName.getText().equals("")
				|| frmtdtxtfldMaxCapacity.getText().equals("")
				|| frmtdtxtfldMinAge.getText().equals("")
				|| frmtdtxtfldMinHeight.getText().equals("")) {
			JOptionPane.showMessageDialog(this,
					"Please enter your data in the specific area.", "ERROR",
					JOptionPane.ERROR_MESSAGE);
			return;
		} else {
			int capacity;
			try {
				capacity = Integer.parseInt(frmtdtxtfldMaxCapacity.getText()
						.replaceAll(",", ""));
			} catch (Exception e) {
				JOptionPane.showMessageDialog(this,
						"Invalid capacity. Please try again.", "ERROR",
						JOptionPane.ERROR_MESSAGE);
				frmtdtxtfldMaxCapacity.setText("");
				return;
			}
			int age;
			try {
				age = Integer.parseInt(frmtdtxtfldMinAge.getText().replaceAll(
						",", ""));
			} catch (Exception e) {
				JOptionPane.showMessageDialog(this,
						"Invalid age limitation. Please try again.", "ERROR",
						JOptionPane.ERROR_MESSAGE);
				frmtdtxtfldMinAge.setText("");
				return;
			}

			int height;
			try {
				height = Integer.parseInt(frmtdtxtfldMinHeight.getText()
						.replaceAll(",", ""));
			} catch (Exception e) {
				JOptionPane.showMessageDialog(this,
						"Invalid height limitation. Please try again.",
						"ERROR", JOptionPane.ERROR_MESSAGE);
				frmtdtxtfldMinHeight.setText("");
				return;
			}

			try {
				rideID = supervisor.createNewRide(rideName, isExtreme,
						capacity, age, height);
				JOptionPane.showMessageDialog(this,
						"The ride was created successfully!\n"
								+ "The ride's ID is: " + rideID.toString());

				createRidePanel.setVisible(false);
				supervisorMainPanel.setVisible(true);

			} catch (InvalidCapacity e) {
				JOptionPane.showMessageDialog(this,
						"Invalid ride's capacity. Please try again.", "ERROR",
						JOptionPane.ERROR_MESSAGE);
				frmtdtxtfldGuardianId.setText("");
				return;
			} catch (InvalidAgeParam e) {
				JOptionPane.showMessageDialog(this,
						"Invalid ride's age. Please try again.", "ERROR",
						JOptionPane.ERROR_MESSAGE);
				frmtdtxtfldGuardianId.setText("");
				return;
			} catch (InvalidHeightParam e) {
				JOptionPane.showMessageDialog(this,
						"Invalid ride's height. Please try again.", "ERROR",
						JOptionPane.ERROR_MESSAGE);
				frmtdtxtfldGuardianId.setText("");
				return;
			}

		}

		txtName.setText("");
		frmtdtxtfldMaxCapacity.setText("");
		frmtdtxtfldMinAge.setText("");
		frmtdtxtfldMinHeight.setText("");
	}

	private void initParkClasses() throws Exception {
		supervisor = new SupervisorStation(centralComputer);
		application = new Application(centralComputer);
	}

	private void initilizeView() {
		mainPanel.setVisible(true);
		supervisorMainPanel.setVisible(false);
		createRidePanel.setVisible(false);
		displayTicketsPerRidePanel.setVisible(false);

	}

	/**
	 * Create the frame.
	 */
	public MainGui() throws Exception {
		setTitle("E-Park");

		boolean retryFileOpening = true;
		while (retryFileOpening) {
			try {
				String currentDir = new java.io.File(".").getCanonicalPath();
				fileOpen = new JFileChooser(currentDir);
				fileOpen.showOpenDialog(this);
				// currentDir = fileOpen.getCurrentDirectory().toString();
				String path = fileOpen.getSelectedFile().getAbsolutePath();
				centralComputer = new CentralComputer(path);
				retryFileOpening = false;
			} catch (XMLRidesParserException e) {
				Object[] options = { "Yes, retry", "No, exit program" };
				int userChoice = JOptionPane.showOptionDialog(this,
						"Whould you like to try entering the file again?",
						"Parsing error!", JOptionPane.YES_NO_OPTION,
						JOptionPane.ERROR_MESSAGE, null, // do not use a
															// custom Icon
						options, // the titles of buttons
						options[0]); // default button title
				if (userChoice == EXIT_CHOISE) {
					System.exit(0);
				}

			}
		}

		initParkClasses();
		initilize();
		initilizeView();
		createEvents();
	}
}
